Encoder, decoder, encoding method, and decoding method

ABSTRACT

An encoder includes circuitry and memory coupled to the circuitry. The circuitry, in operation, for each coefficient of a plurality of coefficients included in a block, determines a base level relating to Context-Based Adaptive Binary Arithmetic Coding (CABAC) for the coefficient, and encodes an absolute value of the coefficient. In determining the base level, when one or more flags are used in encoding the absolute value of the coefficient, the base level is determined to be a first value, and when one or more flags are not used in the encoding, the base level is determined to be a second value that is smaller than the first value. In encoding the absolute value of the coefficient, when one or more flags are not used, a rice parameter is determined based on the base level which is equal to the second value, and the coefficient is binarized using the rice parameter.

CROSS REFERENCE TO RELATED APPLICATIONS

This is a continuation application of U.S. patent application Ser. No.17/173,024 filed on Feb. 10, 2021, which is a continuation applicationof PCT International Application No. PCT/JP2019/037618 filed on Sep. 25,2019, which claims priority to U.S. Provisional Patent Application No.62/738,399 filed on Sep. 28, 2018. The entire disclosures of theabove-identified applications, including the specifications, drawingsand claims are incorporated herein by reference in their entirety.

BACKGROUND Technical Field

This disclosure relates to video coding, and particularly to videoencoding and decoding systems, components, and methods.

Description of the Related Art

With advancement in video coding technology, from H.261 and MPEG-1 toH.264/AVC (Advanced Video Coding), MPEG-LA, H.265/HEVC (High EfficiencyVideo Coding) and H.266/VVC (Versatile Video Codec), there remains aconstant need to provide improvements and optimizations to the videocoding technology to process an ever-increasing amount of digital videodata in various applications.

It should be noted that Non Patent Literature (NPL) 1 relates to oneexample of the conventional standard related to the above-describedvideo coding technique.

CITATION LIST Non Patent Literature

[NPL 1] H.265 (ISO/IEC 23008-2 HEVC)/HEVC (High Efficiency Video Coding)

BRIEF SUMMARY

For example, an encoder according to an aspect of the present disclosureincludes circuitry; and memory coupled to the circuitry. In the encoder,the circuitry, in operation, encodes, for each of a plurality ofcoefficients, an absolute value of the coefficient in predeterminedorder, the plurality of coefficients being included in a structural unitof an image which has been transformed and quantized, and encodes, foreach of the plurality of coefficients, a sign indicating whether thecoefficient is positive or negative, in encoding the absolute value, asignal indicating parity that is a least significant bit of the absolutevalue is encoded, whether to use a flag in encoding a portion of theabsolute value other than the least significant bit is determined basedon a first condition and a second condition, and the flag is encoded bycontext-based adaptive binary arithmetic coding (CABAC) involvingupdating a symbol occurrence probability when it is determined that theflag is to be used, the first condition is based on a magnitude of theabsolute value, and the second condition is for limiting a total numberof flags used in the structural unit.

Some implementations of embodiments of the present disclosure mayimprove an encoding efficiency, may simply be an encoding/decodingprocess, may accelerate an encoding/decoding process speed, mayefficiently select appropriate components/operations used in encodingand decoding such as appropriate filter, block size, motion vector,reference picture, reference block, etc.

Additional benefits and advantages of one aspect of the presentdisclosure will become apparent from the specification and drawings. Thebenefits and/or advantages may be individually obtained by the variousembodiments and features of the specification and drawings, not all ofwhich need to be provided in order to obtain one or more of suchbenefits and/or advantages.

It should be noted that general or specific embodiments may beimplemented as a system, a method, an integrated circuit, a computerprogram, a storage medium, or any selective combination thereof.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

These and other advantages and features will become apparent from thefollowing description thereof taken in conjunction with the accompanyingDrawings, by way of non-limiting examples of embodiments disclosedherein.

FIG. 1 is a block diagram illustrating a functional configuration of anencoder according to an embodiment.

FIG. 2 is a flow chart indicating one example of an overall encodingprocess performed by the encoder.

FIG. 3 is a conceptual diagram illustrating one example of blocksplitting.

FIG. 4A is a conceptual diagram illustrating one example of a sliceconfiguration.

FIG. 4B is a conceptual diagram illustrating one example of a tileconfiguration.

FIG. 5A is a chart indicating transform basis functions for varioustransform types.

FIG. 5B is a conceptual diagram illustrating example spatially varyingtransforms (SVT).

FIG. 6A is a conceptual diagram illustrating one example of a filtershape used in an adaptive loop filter (ALF).

FIG. 6B is a conceptual diagram illustrating another example of a filtershape used in an ALF.

FIG. 6C is a conceptual diagram illustrating another example of a filtershape used in an ALF.

FIG. 7 is a block diagram indicating one example of a specificconfiguration of a loop filter which functions as a deblocking filter(DBF).

FIG. 8 is a conceptual diagram indicating an example of a deblockingfilter having a symmetrical filtering characteristic with respect to ablock boundary.

FIG. 9 is a conceptual diagram for illustrating a block boundary onwhich a deblocking filter process is performed.

FIG. 10 is a conceptual diagram indicating examples of Bs values.

FIG. 11 is a flow chart illustrating one example of a process performedby a prediction processor of the encoder.

FIG. 12 is a flow chart illustrating another example of a processperformed by the prediction processor of the encoder.

FIG. 13 is a flow chart illustrating another example of a processperformed by the prediction processor of the encoder.

FIG. 14 is a conceptual diagram illustrating sixty-seven intraprediction modes used in intra prediction in an embodiment.

FIG. 15 is a flow chart illustrating an example basic processing flow ofinter prediction.

FIG. 16 is a flow chart illustrating one example of derivation of motionvectors.

FIG. 17 is a flow chart illustrating another example of derivation ofmotion vectors.

FIG. 18 is a flow chart illustrating another example of derivation ofmotion vectors.

FIG. 19 is a flow chart illustrating an example of inter prediction innormal inter mode.

FIG. 20 is a flow chart illustrating an example of inter prediction inmerge mode.

FIG. 21 is a conceptual diagram for illustrating one example of a motionvector derivation process in merge mode.

FIG. 22 is a flow chart illustrating one example of frame rate upconversion (FRUC) process.

FIG. 23 is a conceptual diagram for illustrating one example of patternmatching (bilateral matching) between two blocks along a motiontrajectory.

FIG. 24 is a conceptual diagram for illustrating one example of patternmatching (template matching) between a template in a current picture anda block in a reference picture.

FIG. 25A is a conceptual diagram for illustrating one example ofderiving a motion vector of each sub-block based on motion vectors of aplurality of neighboring blocks.

FIG. 25B is a conceptual diagram for illustrating one example ofderiving a motion vector of each sub-block in affine mode in which threecontrol points are used.

FIG. 26A is a conceptual diagram for illustrating an affine merge mode.

FIG. 26B is a conceptual diagram for illustrating an affine merge modein which two control points are used.

FIG. 26C is a conceptual diagram for illustrating an affine merge modein which three control points are used.

FIG. 27 is a flow chart illustrating one example of a process in affinemerge mode.

FIG. 28A is a conceptual diagram for illustrating an affine inter modein which two control points are used.

FIG. 28B is a conceptual diagram for illustrating an affine inter modein which three control points are used.

FIG. 29 is a flow chart illustrating one example of a process in affineinter mode.

FIG. 30A is a conceptual diagram for illustrating an affine inter modein which a current block has three control points and a neighboringblock has two control points.

FIG. 30B is a conceptual diagram for illustrating an affine inter modein which a current block has two control points and a neighboring blockhas three control points.

FIG. 31A is a flow chart illustrating a merge mode process includingdecoder motion vector refinement (DMVR).

FIG. 31B is a conceptual diagram for illustrating one example of a DMVRprocess.

FIG. 32 is a flow chart illustrating one example of generation of aprediction image.

FIG. 33 is a flow chart illustrating another example of generation of aprediction image.

FIG. 34 is a flow chart illustrating another example of generation of aprediction image.

FIG. 35 is a flow chart illustrating one example of a prediction imagecorrection process performed by an overlapped block motion compensation(OBMC) process.

FIG. 36 is a conceptual diagram for illustrating one example of aprediction image correction process performed by an OBMC process.

FIG. 37 is a conceptual diagram for illustrating generation of twotriangular prediction images.

FIG. 38 is a conceptual diagram for illustrating a model assuminguniform linear motion.

FIG. 39 is a conceptual diagram for illustrating one example of aprediction image generation method using a luminance correction processperformed by a local illumination compensation (LIC) process.

FIG. 40 is a block diagram illustrating a mounting example of theencoder.

FIG. 41 is a block diagram illustrating a functional configuration of adecoder according to an embodiment.

FIG. 42 is a flow chart illustrating one example of an overall decodingprocess performed by the decoder.

FIG. 43 is a flow chart illustrating one example of a process performedby a prediction processor of the decoder.

FIG. 44 is a flow chart illustrating another example of a processperformed by the prediction processor of the decoder.

FIG. 45 is a flow chart illustrating an example of inter prediction innormal inter mode in the decoder.

FIG. 46 is a block diagram illustrating a mounting example of thedecoder.

FIG. 47 is a diagram for explaining an outline of dependent Quantization(DQ).

FIG. 48 is a diagram illustrating one example of state transition of aquantizer.

FIG. 49 is a diagram illustrating one example of the state transition ofthe quantizer.

FIG. 50 is a diagram illustrating one example of binarization of aremainder.

FIG. 51 is a diagram for explaining a method of determining a riceparameter.

FIG. 52 is a diagram illustrating a code length (i.e., the number ofbits) of a binary signal obtained by Golomb-Rice coding of a remainder.

FIG. 53 is a flowchart illustrating overall processing operations of anentropy encoder according to a first example of a first aspect.

FIG. 54 is a flowchart illustrating one example of the detailedprocessing operation of Step S110 illustrated in FIG. 53 .

FIG. 55 is a flowchart illustrating one example of the detailedprocessing operation of Step S120 illustrated in FIG. 53 .

FIG. 56 is a flowchart illustrating one example of a detailed processingoperation of Step S130 illustrated in FIG. 53 .

FIG. 57 is a diagram illustrating syntax related to entropy encodingaccording to a first example of the first aspect.

FIG. 58 is a diagram illustrating a specific example of a sub-blockincluding 4×4 coefficients.

FIG. 59 is a diagram illustrating a specific example indicating each ofthe coefficients included in the sub-block illustrated in FIG. 58 , in aflag format according to the first example of the first aspect.

FIG. 60 is a flowchart illustrating overall processing operations of anentropy encoder according to a second example of the first aspect.

FIG. 61 is a flowchart illustrating one example of a detailed processingoperation of Step S210 illustrated in FIG. 60 .

FIG. 62 is a flowchart illustrating one example of a detailed processingoperation of Step S220 illustrated in FIG. 60 .

FIG. 63 is a flowchart illustrating one example of a detailed processingoperation of Step S230 illustrated in FIG. 60 . FIG. 64 is a diagramillustrating syntax related to entropy encoding according to the secondexample of the first aspect.

FIG. 65 is a diagram illustrating a specific example indicating each ofthe coefficients included in the sub-block illustrated in FIG. 58 , in aflag format according to the second example of the first aspect.

FIG. 66 is a flowchart illustrating overall processing operations of anentropy encoder according to the second aspect.

FIG. 67 is a flowchart illustrating one example of a detailed processingoperation of Step S330 illustrated in FIG. 66 .

FIG. 68 is a diagram illustrating syntax related to entropy encodingaccording to the second aspect.

FIG. 69 is a diagram illustrating a specific example indicating each ofthe coefficients included in the sub-block illustrated in FIG. 58 , inthe flag format according to the second aspect.

FIG. 70 is a flowchart illustrating overall processing operations of anentropy encoder according to a third aspect.

FIG. 71 is a flowchart illustrating one example of the detailedprocessing operation of Step S430 illustrated in FIG. 70 .

FIG. 72 is a flowchart illustrating processing operations performed byan encoder according to Embodiment 2.

FIG. 73 is a flowchart illustrating encoding a remainder performed bythe encoder according to Embodiment 2.

FIG. 74 is a flowchart illustrating processing operations performed by adecoder according to Embodiment 2.

FIG. 75 is a flowchart illustrating decoding a remainder performed bythe decoder according to Embodiment 2.

FIG. 76 is a block diagram illustrating an overall configuration of acontent providing system for implementing a content distributionservice.

FIG. 77 is a conceptual diagram illustrating one example of an encodingstructure in scalable encoding.

FIG. 78 is a conceptual diagram illustrating one example of an encodingstructure in scalable encoding.

FIG. 79 is a conceptual diagram illustrating an example of a displayscreen of a web page.

FIG. 80 is a conceptual diagram illustrating an example of a displayscreen of a web page.

FIG. 81 is a block diagram illustrating one example of a smartphone.

FIG. 82 is a block diagram illustrating an example of a configuration ofa smartphone.

DETAILED DESCRIPTION

An encoder includes: circuitry; and memory coupled to the circuitry. Inthe encoder, for each coefficient of a plurality of coefficientsincluded in a block, the circuitry, in operation: determines a baselevel relating to Context-Based Adaptive Binary Arithmetic Coding(CABAC) for the coefficient; and encodes an absolute value of thecoefficient, wherein in determining the base level, when one or moreflags are used in encoding the absolute value of the coefficient, thebase level is determined to be a first value, and when one or more flagsare not used in encoding the absolute value of the coefficient, the baselevel is determined to be a second value that is smaller than the firstvalue, and in encoding the absolute value of the coefficient, when oneor more flags are not used, a rice parameter is determined based on thebase level which is equal to the second value, and the coefficient isbinarized using the rice parameter.

In the encoder, whether to use a flag of the one or more flags may bedetermined based on a first condition and a second condition, whereinthe first condition may be based on the absolute value of thecoefficient, and the second condition may be for limiting a total numberof flags used in the block.

In the encoder, in the encoding of the absolute value, the circuitry,every time the flag is encoded, may count a total number of the flagsencoded, and when the second condition is not satisfied, may determinethat the flag is not to be used in encoding the coefficient, even whenthe first condition is satisfied, and the second condition may be that atotal number of the flags encoded is less than a limit.

In the encoder, the first condition may be one of a condition that theabsolute value of the coefficient is not a third value and a conditionthat the absolute value of the coefficient is greater than a fourthvalue, the fourth value being greater than the third value.

In the encoder, the first value may be zero, and the second value may bethree.

In the encoder, the one or more flags may include flags of mutuallydifferent types.

In the encoder, the circuitry, in determining the rice parameter of afirst coefficient in the block, may use second to sixth coefficients inthe block, the second to the sixth coefficients being located around thefirst coefficient.

An encoder includes: memory; and a processor coupled to the memory andconfigured to perform Context-Based Adaptive Binary Arithmetic Coding(CABAC) of H.266/VVC (Versatile Video Coding) standard. In the encoder,the CABAC includes: obtaining a base level corresponding to a firstquantized coefficient in a block; calculating absolute values of secondto sixth quantized coefficients in the block, the second to the sixthquantized coefficients being provided around the first quantizedcoefficient in the block; calculating a rice parameter based on the baselevel and the absolute values; and binarizing the first quantizedcoefficient based on the rice parameter.

In the encoder, the processor may be configured to calculate the riceparameter based on a difference between each of the absolute values andthe base level.

A decoder includes: circuitry; and memory coupled to the circuitry. Inthe decoder, for each coefficient of a plurality of coefficientsincluded in a block, the circuitry, in operation: determines a baselevel relating to Context-Based Adaptive Binary Arithmetic Coding(CABAC) for the coefficient; and decodes an absolute value of thecoefficient, wherein in determining the base level, when one or moreflags are used in decoding the absolute value of the coefficient, thebase level is determined to be a first value, and when one or more flagsare not used in decoding the absolute value of the coefficient, the baselevel is determined to be a second value, the second value being smallerthan the first value, in decoding the absolute value of the coefficient,when one or more flags are not used, a rice parameter is determinedbased on the base level which is equal to the second value, and thecoefficient is debinarized using the rice parameter.

In the decoder, when each coefficient of the plurality of coefficientsincluded in the block is encoded, whether to use a flag of the one ormore flags may be determined based on a first condition and a secondcondition, wherein the first condition may be based on the absolutevalue of the coefficient, and the second condition may be for limiting atotal number of flags used in the block.

In the decoder, in the decoding of the absolute value, the circuitry,every time the flag is decoded, may count a total number of the flagsdecoded, and when each coefficient of the plurality of coefficientsincluded in the block is encoded, when the second condition is notsatisfied, may determine that the flag is not to be used in encoding thecoefficient, even when the first condition is satisfied, and the secondcondition may be that a total number of the flags encoded is less than alimit.

In the decoder, the first condition may be one of a condition that theabsolute value of the coefficient is not a third value and a conditionthat the absolute value of the coefficient is greater than a fourthvalue, the fourth value being greater than the third value.

In the decoder, the first value may be zero, and the second value may bethree.

In the decoder, the one or more flags may include flags of mutuallydifferent types.

In the decoder, the circuitry, in determining the rice parameter of afirst coefficient in the block, may use second to sixth coefficients inthe block, the second to the sixth coefficients being located around thefirst coefficient.

A decoder includes: memory; and a processor coupled to the memory andconfigured to perform decoding by Context-Based Adaptive BinaryArithmetic Coding (CABAC) of H.266/VVC (Versatile Video Coding)standard. In the decoder, the decoding by the CABAC includes: obtaininga base level corresponding to a first quantized coefficient in a block;calculating absolute values of second to sixth quantized coefficients inthe block, the second to the sixth quantized coefficients being providedaround the first quantized coefficient in the block; calculating a riceparameter based on the base level and the absolute values; anddebinarizing the first quantized coefficient based on the riceparameter.

In the decoder, the processor may be configured to calculate the riceparameter based on a difference between each of the absolute values andthe base level.

An encoding method includes: for each coefficient of a plurality ofcoefficients included in a block, determining a base level relating toContext-Based Adaptive Binary Arithmetic Coding (CABAC) for thecoefficient; and encoding an absolute value of the coefficient. In theencoding method: in the determining, when one or more flags are used inthe encoding, the base level is determined to be a first value, and whenone or more flags are not used in the encoding, the base level isdetermined to be a second value that is smaller than the first value;and in the encoding of the absolute value of the coefficient, when oneor more flags are not used, a rice parameter is determined based on thebase level which is equal to the second value, and the coefficient isbinarized using the rice parameter.

An encoding method includes performing Context-Based Adaptive BinaryArithmetic Coding (CABAC) of H.266/VVC (Versatile Video Coding)standard. In the encoding method, the performing of the CABAC includes:obtaining a base level corresponding to a first quantized coefficient ina block; calculating absolute values of second to sixth quantizedcoefficients in the block, the second to the sixth quantizedcoefficients being provided around the first quantized coefficient inthe block; calculating a rice parameter based on the base level and theabsolute values; and binarizing the first quantized coefficient based onthe rice parameter.

A decoding method includes: for each coefficient of a plurality ofcoefficients included in a block, determining a base level relating toContext-Based Adaptive Binary Arithmetic Coding (CABAC) for thecoefficient; and decoding an absolute value of the coefficient. In thedecoding method: in the determining, when one or more flags are used inthe decoding, the base level is determined to be a first value, and whenone or more flags are not used in the decoding, the base level isdetermined to be a second value that is smaller than the first value; inthe decoding, when one or more flags are not used, a rice parameter isdetermined based on the base level which is equal to the second value,and the coefficient is debinarized using the rice parameter.

A decoding method includes decoding by Context-Based Adaptive BinaryArithmetic Coding (CABAC) of H.266/VVC (Versatile Video Coding)standard. In the decoding, the decoding by the CABAC includes: obtaininga base level corresponding to a first quantized coefficient in a block;calculating absolute values of second to sixth quantized coefficients inthe block, the second to the sixth quantized coefficients being providedaround the first quantized coefficient in the block; calculating a riceparameter based on the base level and the absolute values; anddebinarizing the first quantized coefficient based on the riceparameter.

In view of the above, an encoder according to one aspect of the presentdisclosure includes circuitry; and memory coupled to the circuitry. Inthe encoder, the circuitry, in operation, encodes, for each of aplurality of coefficients, an absolute value of the coefficient inpredetermined order, the plurality of coefficients being included in astructural unit of an image which has been transformed and quantized,and encodes, for each of the plurality of coefficients, a signindicating whether the coefficient is positive or negative, in encodingthe absolute value, a signal indicating parity that is a leastsignificant bit of the absolute value is encoded, whether to use a flagin encoding a portion of the absolute value other than the leastsignificant bit is determined based on a first condition and a secondcondition, and the flag is encoded by context-based adaptive binaryarithmetic coding (CABAC) involving updating a symbol occurrenceprobability when it is determined that the flag is to be used, the firstcondition is based on a magnitude of the absolute value, and the secondcondition is for limiting a total number of flags used in the structuralunit.

In this manner, whether or not to use a flag is determined on the basisof not only the first condition based on the magnitude of an absolutevalue of a coefficient, but also the second condition for limiting thenumber of flags, and thus it is possible to appropriately limit thenumber of flags.

When a flag is to be used, it is possible to reduce a coding amount ofan absolute value of a coefficient. When a flag is not to be used, thereis a possibility of an increase in a coding amount of an absolute valueof a coefficient; that is, a possibility of an increase in a codingamount of a remainder for indicating an absolute value of a coefficient.In addition, there are cases where the CABAC in which an adaptive andvariable symbol occurrence probability is used is applied in encoding aflag, and bypass processing of the CABAC in which a fixed symboloccurrence probability is used is applied in encoding a remainder. Here,in the CABAC in which the variable symbol occurrence probability isused, a processing load tends to be higher than the bypass processing.Accordingly, with the encoder according to one aspect of the presentdisclosure, the number of flags can be appropriately limited, and thusit is possible to reduce both of a coding amount of an absolute valuethereof and a processing load for encoding the absolute value.

In addition, in the encoding of the absolute value, the circuitry, everytime the flag is encoded, may count a total number of flags encoded, andwhen the second condition is not satisfied, may determine that the flagis not to be used in the encoding of the portion of the absolute valueother than the least significant bit, even when the first condition issatisfied, and the second condition may be that a total number of countscorresponding to a total number of the flags counted is less than alimit.

In this manner, every time a flag is encoded, the number of encodedflags is counted. Accordingly, it is possible to more appropriatelylimit the number of flags.

In addition, the first condition may be one of a condition that theabsolute value is not a first value and a condition that the absolutevalue is greater than or equal to a second value. For example, the firstvalue may be 0, and the second value may be 3.

With this, for a coefficient whose absolute value is not 0, for example,it is possible to appropriately limit the number of flags (e.g., thegt1_flag) indicating whether the absolute value is greater than or equalto 3. Alternatively, for a coefficient whose absolute value is greaterthan or equal to 3, for example, it is possible to appropriately limitthe number of flags (e.g., the gt2_flag) indicating whether or not theabsolute value is greater than or equal to 5.

In addition, the flag may include flags of mutually different types.

With this, for example, it is possible to appropriately limit the numberof each of different types of flags such as the above-described gt1_flagand gt2_flag.

In addition, the circuitry, further in the encoding of the absolutevalue, when the flag cannot be used or when the absolute value cannot berepresented by only at least one flag, may derive a remainder includinga numerical value for representing the absolute value, and may encodethe remainder derived, by bypass processing of the CABAC.

In this manner, it is possible to appropriately encode an absolute valueof a coefficient as a flag or as a data group including at least oneflag and a remainder.

In addition, the circuitry: in deriving the remainder, may determine abase level indicating a numerical value which varies according towhether a total number of counts has reached a limit, the total numberof counts corresponding to a total number of the flags encoded forcoefficients located prior to a coefficient corresponding to theremainder among the plurality of the coefficients, and derive theremainder using the base level determined; and in the encoding of theremainder, may select a binarizing method corresponding to the remainderfrom among a plurality of binarizing methods different from one another,based on the base level used in the deriving of the remainder, binarizethe remainder according to the binarizing method selected, and performarithmetic coding on the remainder binarized. For example, a base leveldetermined when the total number of counts has reached the limit may beless than a base level determined when the total number of counts isless than the limit.

In this manner, it is possible to appropriately derive, using a baselevel, a remainder corresponding to an absolute value of a coefficient.In addition, since a binarizing method to be used in binarizing aremainder is selected based on the base level, it is possible toappropriately reduce the coding amount of the remainder.

In addition, a decoder according to one aspect of the present disclosureincludes circuitry; and memory coupled to the circuitry. In the decoder,the circuitry, in operation, decodes, for each of a plurality ofcoefficients, an absolute value of the coefficient in predeterminedorder, the plurality of coefficients being included in a structural unitof an image which has been encoded, and decodes, for each of theplurality of coefficients, a sign indicating whether the coefficient ispositive or negative, in the structural unit, among N coefficients eachhaving an absolute value which satisfies a predetermined conditionrelated to a magnitude, a flag is used in encoding an absolute value ofeach of M coefficients, and the flag is not used in encoding an absolutevalue of each of remaining (N−M) coefficients, N being an integergreater than or equal to 2, M being an integer less than N, in decodingthe absolute value, a signal indicating parity that is a leastsignificant bit of the absolute value is decoded, and when the flag isused in encoding a portion of the absolute value other than the leastsignificant bit, the flag is decoded by context-based adaptive binaryarithmetic coding (CABAC) involving updating a symbol occurrenceprobability.

With this, even when the number of flags used in encoding a structuralunit of an image is limited, it is possible to appropriately decode theencoded structural unit of the image.

In addition, the predetermined condition may be one of a condition thatthe absolute value of the coefficient is not a first value and acondition that the absolute value of the coefficient is greater than orequal to a second value. For example, the first value may be 0, and thesecond value may be 3.

With this, for a coefficient whose absolute value is not 0, for example,even when the number of the flags (e.g., the gt1_flag) indicatingwhether the absolute value is greater than or equal to 3 is limited, itis possible to appropriately decode the encoded structural unit of theimage. Alternatively, for a coefficient whose absolute value is greaterthan or equal to 3, for example, even when the number of the flags(e.g., the gt2_flag) indicating whether the absolute value is greaterthan or equal to 5 is limited, it is possible to appropriately decodethe encoded structural unit of the image.

In addition, the flag may include flags of mutually different types.

With this, for example, even when the number of each of the differenttypes of flags such as the above-described gt1_flag and gt2_flag islimited, it is possible to appropriately decode the encoded structuralunit of the image.

In addition, the circuitry, further in the decoding of the absolutevalue, when a remainder including a numerical value for representing theabsolute value has been encoded, may decode the remainder by bypassprocessing of the CABAC

In this manner, even when an absolute value of a coefficient is encodedas a flag or a data group including at least one flag and a remainder,it is possible to appropriately decode the encoded structural unit ofthe image.

In addition, in decoding the remainder, the circuitry may determine abase level indicating a numerical value which varies according towhether a total number of counts has reached a limit, the total numberof counts corresponding to a total number of the flags decoded forcoefficients located prior to a coefficient corresponding to theremainder among the plurality of the coefficients, perform arithmeticdecoding on the remainder into a binary signal, select a debinarizingmethod corresponding to the binary signal from among a plurality ofdebinarizing methods different from one another, based on the base leveldetermined, and debinarize the binary signal according to thedebinarizing method selected. For example, a base level determined whenthe total number of counts has reached the limit is less than a baselevel determined when the total number of counts may be less than thelimit.

In this manner, since a debinarizing method to be used in debinarizing abinary signal is selected based on a base level, it is possible toappropriately decode the remainder.

Alternatively, for example, an encoder according to one aspect of thepresent disclosure includes a splitter, an intra predictor, an interpredictor, a loop filter, a transformer, a quantizer, and an entropyencoder.

The splitter splits a picture included in an image into a plurality ofblocks. The intra predictor predicts a block included in the picture,using the picture. The inter predictor predicts the block, using areference picture different from the picture. The loop filter applies afilter to an image reconstructed from a prediction image generated as aresult of prediction by the intra predictor or the inter predictor.

The transformer transforms a prediction error between the predictionimage and the block, to generate a transform coefficient of the block.The quantizer quantizes the transform coefficient. The entropy encoderencodes the transform coefficient which has been quantized.

In addition, for example, the entropy encoder encodes, for each of aplurality of coefficients, an absolute value of the coefficient inpredetermined order, the plurality of coefficients being included in astructural unit of an image which has been transformed and quantized,and encodes, for each of the plurality of coefficients, a signindicating whether the coefficient is positive or negative, in encodingthe absolute value, a signal indicating parity that is a leastsignificant bit of the absolute value is encoded, whether to use a flagin encoding a portion of the absolute value other than the leastsignificant bit is determined based on a first condition and a secondcondition, and the flag is encoded by context-based adaptive binaryarithmetic coding (CABAC) involving updating a symbol occurrenceprobability when it is determined that the flag is to be used, the firstcondition is based on a magnitude of the absolute value, and the secondcondition is for limiting a total number of flags used in the structuralunit.

Alternatively, for example, the decoder according to one aspect of thepresent disclosure includes an entropy decoder, an inverse quantizer, aninverse transformer, an intra predictor, an inter predictor, and a loopfilter.

The entropy decoder decodes a quantized transform coefficient of a blockincluded in a picture included in an encoded image. The inversequantizer performs inverse quantization on the quantized transformcoefficient. The inverse transformer performs inverse transformation onthe transform coefficient, to obtain a prediction error of the block.

The intra predictor predicts the block, using the picture. The interpredictor predicts the block, using a reference picture different fromthe picture. The loop filter applies a filter to an image reconstructedfrom a prediction image generated as a result of prediction by the intrapredictor or the inter predictor.

In addition, for example, the entropy decoder decodes, for each of aplurality of coefficients, an absolute value of the coefficient inpredetermined order, the plurality of coefficients being included in astructural unit of an image which has been encoded, and decodes, foreach of the plurality of coefficients, a sign indicating whether thecoefficient is positive or negative, in the structural unit, among Ncoefficients each having an absolute value which satisfies apredetermined condition related to a magnitude, a flag is used inencoding an absolute value of each of M coefficients, and the flag isnot used in encoding an absolute value of each of remaining (N−M)coefficients, N being an integer greater than or equal to 2, M being aninteger less than N, in decoding the absolute value, a signal indicatingparity that is a least significant bit of the absolute value is decoded,and when the flag is used in encoding a portion of the absolute valueother than the least significant bit, the flag is decoded bycontext-based adaptive binary arithmetic coding (CABAC) involvingupdating a symbol occurrence probability.

Furthermore, these general and specific aspects may be implemented usinga system, an apparatus, a method, an integrated circuit, a computerprogram, or a non-transitory computer-readable recording medium such asa compact disc read only memory (CD-ROM), or any combination of systems,apparatuses, methods, integrated circuits, computer programs, orrecording media.

Hereinafter, embodiments will be described with reference to thedrawings. Note that the embodiments described below each show a generalor specific example. The numerical values, shapes, materials,components, the arrangement and connection of the components, steps, therelation and order of the steps, etc., indicated in the followingembodiments are mere examples, and are not intended to limit the scopeof the claims.

Embodiments of an encoder and a decoder will be described below. Theembodiments are examples of an encoder and a decoder to which theprocesses and/or configurations presented in the description of aspectsof the present disclosure are applicable. The processes and/orconfigurations can also be implemented in an encoder and a decoderdifferent from those according to the embodiments. For example,regarding the processes and/or configurations as applied to theembodiments, any of the following may be implemented:

(1) Any of the components of the encoder or the decoder according to theembodiments presented in the description of aspects of the presentdisclosure may be substituted or combined with another componentpresented anywhere in the description of aspects of the presentdisclosure.

(2) In the encoder or the decoder according to the embodiments,discretionary changes may be made to functions or processes performed byone or more components of the encoder or the decoder, such as addition,substitution, removal, etc., of the functions or processes. For example,any function or process may be substituted or combined with anotherfunction or process presented anywhere in the description of aspects ofthe present disclosure.

(3) In methods implemented by the encoder or the decoder according tothe embodiments, discretionary changes may be made such as addition,substitution, and removal of one or more of the processes included inthe method. For example, any process in the method may be substituted orcombined with another process presented anywhere in the description ofaspects of the present disclosure.

(4) One or more components included in the encoder or the decoderaccording to embodiments may be combined with a component presentedanywhere in the description of aspects of the present disclosure, may becombined with a component including one or more functions presentedanywhere in the description of aspects of the present disclosure, andmay be combined with a component that implements one or more processesimplemented by a component presented in the description of aspects ofthe present disclosure.

(5) A component including one or more functions of the encoder or thedecoder according to the embodiments, or a component that implements oneor more processes of the encoder or the decoder according to theembodiments, may be combined or substituted with a component presentedanywhere in the description of aspects of the present disclosure, with acomponent including one or more functions presented anywhere in thedescription of aspects of the present disclosure, or with a componentthat implements one or more processes presented anywhere in thedescription of aspects of the present disclosure.

(6) In methods implemented by the encoder or the decoder according tothe embodiments, any of the processes included in the method may besubstituted or combined with a process presented anywhere in thedescription of aspects of the present disclosure or with anycorresponding or equivalent process.

(7) One or more processes included in methods implemented by the encoderor the decoder according to the embodiments may be combined with aprocess presented anywhere in the description of aspects of the presentdisclosure.

(8) The implementation of the processes and/or configurations presentedin the description of aspects of the present disclosure is not limitedto the encoder or the decoder according to the embodiments. For example,the processes and/or configurations may be implemented in a device usedfor a purpose different from the moving picture encoder or the movingpicture decoder disclosed in the embodiments.

[Encoder]

First, an encoder according to an embodiment will be described. FIG. 1is a block diagram illustrating a functional configuration of encoder100 according to the embodiment. Encoder 100 is a video encoder whichencodes a video in units of a block.

As illustrated in FIG. 1 , encoder 100 is an apparatus which encodes animage in units of a block, and includes splitter 102, subtractor 104,transformer 106, quantizer 108, entropy encoder 110, inverse quantizer112, inverse transformer 114, adder 116, block memory 118, loop filter120, frame memory 122, intra predictor 124, inter predictor 126, andprediction controller 128.

Encoder 100 is implemented as, for example, a generic processor andmemory. In this case, when a software program stored in the memory isexecuted by the processor, the processor functions as splitter 102,subtractor 104, transformer 106, quantizer 108, entropy encoder 110,inverse quantizer 112, inverse transformer 114, adder 116, loop filter120, intra predictor 124, inter predictor 126, and prediction controller128. Alternatively, encoder 100 may be implemented as one or morededicated electronic circuits corresponding to splitter 102, subtractor104, transformer 106, quantizer 108, entropy encoder 110, inversequantizer 112, inverse transformer 114, adder 116, loop filter 120,intra predictor 124, inter predictor 126, and prediction controller 128.

Hereinafter, an overall flow of processes performed by encoder 100 isdescribed, and then each of constituent elements included in encoder 100will be described.

[Overall Flow of Encoding Process]

FIG. 2 is a flow chart indicating one example of an overall encodingprocess performed by encoder 100.

First, splitter 102 of encoder 100 splits each of pictures included inan input image which is a video into a plurality of blocks having afixed size (e.g., 128×128 pixels) (Step Sa_1). Splitter 102 then selectsa splitting pattern for the fixed-size block (also referred to as ablock shape) (Step Sa_2). In other words, splitter 102 further splitsthe fixed-size block into a plurality of blocks which form the selectedsplitting pattern. Encoder 100 performs, for each of the plurality ofblocks, Steps Sa_3 to Sa_9 for the block (that is a current block to beencoded).

In other words, a prediction processor which includes all or part ofintra predictor 124, inter predictor 126, and prediction controller 128generates a prediction signal (also referred to as a prediction block)of the current block to be encoded (also referred to as a current block)(Step Sa_3).

Next, subtractor 104 generates a difference between the current blockand a prediction block as a prediction residual (also referred to as adifference block) (Step Sa_4).

Next, transformer 106 transforms the difference block and quantizer 108quantizes the result, to generate a plurality of quantized coefficients(Step Sa_5). It is to be noted that the block having the plurality ofquantized coefficients is also referred to as a coefficient block.

Next, entropy encoder 110 encodes (specifically, entropy encodes) thecoefficient block and a prediction parameter related to generation of aprediction signal to generate an encoded signal (Step Sa_6). It is to benoted that the encoded signal is also referred to as an encodedbitstream, a compressed bitstream, or a stream.

Next, inverse quantizer 112 performs inverse quantization of thecoefficient block and inverse transformer 114 performs inverse transformof the result, to restore a plurality of prediction residuals (that is,a difference block) (Step Sa_7).

Next, adder 116 adds the prediction block to the restored differenceblock to reconstruct the current block as a reconstructed image (alsoreferred to as a reconstructed block or a decoded image block) (StepSa_8). In this way, the reconstructed image is generated.

When the reconstructed image is generated, loop filter 120 performsfiltering of the reconstructed image as necessary (Step Sa_9).

Encoder 100 then determines whether encoding of the entire picture hasbeen finished (Step Sa_10). When determining that the encoding has notyet been finished (No in Step Sa_10), processes from Step Sa_2 areexecuted repeatedly.

Although encoder 100 selects one splitting pattern for a fixed-sizeblock, and encodes each block according to the splitting pattern in theabove-described example, it is to be noted that each block may beencoded according to a corresponding one of a plurality of splittingpatterns. In this case, encoder 100 may evaluate a cost for each of theplurality of splitting patterns, and, for example, may select theencoded signal obtainable by encoding according to the splitting patternwhich yields the smallest cost as an encoded signal which is output.

As illustrated, the processes in Steps Sa_1 to Sa_10 are performedsequentially by encoder 100. Alternatively, two or more of the processesmay be performed in parallel, the processes may be reordered, etc.

[Splitter]

Splitter 102 splits each of pictures included in an input video into aplurality of blocks, and outputs each block to subtractor 104. Forexample, splitter 102 first splits a picture into blocks of a fixed size(for example, 128×128). Other fixed block sizes may be employed. Thefixed-size block is also referred to as a coding tree unit (CTU).Splitter 102 then splits each fixed-size block into blocks of variablesizes (for example, 64×64 or smaller), based on recursive quadtreeand/or binary tree block splitting. In other words, splitter 102 selectsa splitting pattern. The variable-size block is also referred to as acoding unit (CU), a prediction unit (PU), or a transform unit (TU). Itis to be noted that, in various kinds of processing examples, there isno need to differentiate between CU, PU, and TU; all or some of theblocks in a picture may be processed in units of a CU, a PU, or a TU.

FIG. 3 is a conceptual diagram illustrating one example of blocksplitting according to an embodiment. In FIG. 3 , the solid linesrepresent block boundaries of blocks split by quadtree block splitting,and the dashed lines represent block boundaries of blocks split bybinary tree block splitting.

Here, block 10 is a square block having 128×128 pixels (128×128 block).This 128×128 block 10 is first split into four square 64×64 blocks(quadtree block splitting). The upper-left 64×64 block is furthervertically split into two rectangular 32×64 blocks, and the left 32×64block is further vertically split into two rectangular 16×64 blocks(binary tree block splitting). As a result, the upper-left 64×64 blockis split into two 16×64 blocks 11 and 12 and one 32×64 block 13.

The upper-right 64×64 block is horizontally split into two rectangular64×32 blocks 14 and 15 (binary tree block splitting).

The lower-left 64×64 block is first split into four square 32×32 blocks(quadtree block splitting). The upper-left block and the lower-rightblock among the four 32×32 blocks are further split. The upper-left32×32 block is vertically split into two rectangle 16×32 blocks, and theright 16×32 block is further horizontally split into two 16×16 blocks(binary tree block splitting). The lower-right 32×32 block ishorizontally split into two 32×16 blocks (binary tree block splitting).As a result, the lower-left 64×64 block is split into 16×32 block 16,two 16×16 blocks 17 and 18, two 32×32 blocks 19 and 20, and two 32×16blocks 21 and 22.

The lower-right 64×64 block 23 is not split.

As described above, in FIG. 3 , block 10 is split into thirteenvariable-size blocks 11 through 23 based on recursive quadtree andbinary tree block splitting. This type of splitting is also referred toas quadtree plus binary tree (QTBT) splitting.

It is to be noted that, in FIG. 3 , one block is split into four or twoblocks (quadtree or binary tree block splitting), but splitting is notlimited to these examples. For example, one block may be split intothree blocks (ternary block splitting). Splitting including such ternaryblock splitting is also referred to as multi-type tree (MBT) splitting.

[Picture Structure: Slice/Tile]

A picture may be configured in units of one or more slices or tiles inorder to decode the picture in parallel. The picture configured in unitsof one or more slices or tiles may be configured by splitter 102.

Slices are basic encoding units included in a picture. A picture mayinclude, for example, one or more slices. In addition, a slice includesone or more successive coding tree units (CTU).

FIG. 4A is a conceptual diagram illustrating one example of a sliceconfiguration. For example, a picture includes 11×8 CTUs and is splitinto four slices (slices 1 to 4). Slice 1 includes sixteen CTUs, slice 2includes twenty-one CTUs, slice 3 includes twenty-nine CTUs, and slice 4includes twenty-two CTUs. Here, each CTU in the picture belongs to oneof the slices. The shape of each slice is a shape obtainable bysplitting the picture horizontally. A boundary of each slice does notneed to be coincide with an image end, and may be coincide with any ofthe boundaries between CTUs in the image. The processing order of theCTUs in a slice (an encoding order or a decoding order) is, for example,a raster-scan order. A slice includes header information and encodeddata. Features of the slice may be described in header information. Thefeatures include a CTU address of a top CTU in the slice, a slice type,etc.

A tile is a unit of a rectangular region included in a picture. Each oftiles may be assigned with a number referred to as TileId in raster-scanorder.

FIG. 4B is a conceptual diagram indicating an example of a tileconfiguration. For example, a picture includes 11×8 CTUs and is splitinto four tiles of rectangular regions (tiles 1 to 4). When tiles areused, the processing order of CTUs are changed from the processing orderin the case where no tile is used. When no tile is used, CTUs in apicture are processed in raster-scan order. When tiles are used, atleast one CTU in each of the tiles is processed in raster-scan order.For example, as illustrated in FIG. 4B, the processing order of the CTUsincluded in tile 1 is the order which starts from the left-end of thefirst row of tile 1 toward the right-end of the first row of tile 1 andthen starts from the left-end of the second row of tile 1 toward theright-end of the second row of tile 1.

It is to be noted that the one tile may include one or more slices, andone slice may include one or more tiles.

[Subtractor]

Subtractor 104 subtracts a prediction signal (prediction sample that isinput from prediction controller 128 indicated below) from an originalsignal (original sample) in units of a block input from splitter 102 andsplit by splitter 102. In other words, subtractor 104 calculatesprediction errors (also referred to as residuals) of a block to beencoded (hereinafter also referred to as a current block). Subtractor104 then outputs the calculated prediction errors (residuals) totransformer 106.

The original signal is a signal which has been input into encoder 100and represents an image of each picture included in a video (forexample, a luma signal and two chroma signals). Hereinafter, a signalrepresenting an image is also referred to as a sample.

[Transformer]

Transformer 106 transforms prediction errors in spatial domain intotransform coefficients in frequency domain, and outputs the transformcoefficients to quantizer 108. More specifically, transformer 106applies, for example, a defined discrete cosine transform (DCT) ordiscrete sine transform (DST) to prediction errors in spatial domain.The defined DCT or DST may be predefined.

It is to be noted that transformer 106 may adaptively select a transformtype from among a plurality of transform types, and transform predictionerrors into transform coefficients by using a transform basis functioncorresponding to the selected transform type. This sort of transform isalso referred to as explicit multiple core transform (EMT) or adaptivemultiple transform (AMT).

The transform types include, for example, DCT-II, DCT-V, DCT-VIII,DST-I, and DST-VII. FIG. 5A is a chart indicating transform basisfunctions for the example transform types. In FIG. 5A, N indicates thenumber of input pixels. For example, selection of a transform type fromamong the plurality of transform types may depend on a prediction type(one of intra prediction and inter prediction), and may depend on anintra prediction mode.

Information indicating whether to apply such EMT or AMT (referred to as,for example, an EMT flag or an AMT flag) and information indicating theselected transform type is normally signaled at the CU level. It is tobe noted that the signaling of such information does not necessarilyneed to be performed at the CU level, and may be performed at anotherlevel (for example, at the bit sequence level, picture level, slicelevel, tile level, or CTU level).

In addition, transformer 106 may re-transform the transform coefficients(transform result). Such re-transform is also referred to as adaptivesecondary transform (AST) or non-separable secondary transform (NSST).For example, transformer 106 performs re-transform in units of asub-block (for example, 4×4 sub-block) included in a transformcoefficient block corresponding to an intra prediction error.Information indicating whether to apply NSST and information related toa transform matrix for use in NSST are normally signaled at the CUlevel. It is to be noted that the signaling of such information does notnecessarily need to be performed at the CU level, and may be performedat another level (for example, at the sequence level, picture level,slice level, tile level, or CTU level).

Transformer 106 may employ a separable transform and a non-separabletransform. A separable transform is a method in which a transform isperformed a plurality of times by separately performing a transform foreach of a number of directions according to the number of dimensions ofinputs. A non-separable transform is a method of performing a collectivetransform in which two or more dimensions in multidimensional inputs arecollectively regarded as a single dimension.

In one example of a non-separable transform, when an input is a 4×4block, the 4×4 block is regarded as a single array including sixteenelements, and the transform applies a 16×16 transform matrix to thearray.

In another example of a non-separable transform, a 4×4 input block isregarded as a single array including sixteen elements, and then atransform (hypercube givens transform) in which givens revolution isperformed on the array a plurality of times may be performed.

In the transform in transformer 106, the types of bases to betransformed into the frequency domain according to regions in a CU canbe switched. Examples include spatially varying transforms (SVT). InSVT, as illustrated in FIG. 5B, CUs are split into two equal regionshorizontally or vertically, and only one of the regions is transformedinto the frequency domain. A transform basis type can be set for eachregion. For example, DST7 and DST8 are used. In this example, only oneof these two regions in the CU is transformed, and the other is nottransformed. However, both of these two regions may be transformed. Inaddition, the splitting method is not limited to the splitting into twoequal regions, and can be more flexible. For example, the CU may besplit into four equal regions, or information indicating splitting maybe encoded separately and be signaled in the same manner as the CUsplitting. It is to be noted that SVT is also referred to as sub-blocktransform (SBT).

[Quantizer]

Quantizer 108 quantizes the transform coefficients output fromtransformer 106. More specifically, quantizer 108 scans, in a determinedscanning order, the transform coefficients of the current block, andquantizes the scanned transform coefficients based on quantizationparameters (QP) corresponding to the transform coefficients. Quantizer108 then outputs the quantized transform coefficients (hereinafter alsoreferred to as quantized coefficients) of the current block to entropyencoder 110 and inverse quantizer 112. The determined scanning order maybe predetermined.

A determined scanning order is an order for quantizing/inversequantizing transform coefficients. For example, a determined scanningorder may be defined as ascending order of frequency (from low to highfrequency) or descending order of frequency (from high to lowfrequency).

A quantization parameter (QP) is a parameter defining a quantizationstep (quantization width). For example, when the value of thequantization parameter increases, the quantization step also increases.In other words, when the value of the quantization parameter increases,the quantization error increases.

In addition, a quantization matrix may be used for quantization. Forexample, several kinds of quantization matrices may be usedcorrespondingly to frequency transform sizes such as 4×4 and 8×8,prediction modes such as intra prediction and inter prediction, andpixel components such as luma and chroma pixel components. It is to benoted that quantization means digitalizing values sampled at determinedintervals correspondingly to determined levels. In this technical field,quantization may be referred to using other expressions, such asrounding and scaling, and may employ rounding and scaling. Thedetermined intervals and levels may be predetermined.

Methods using quantization matrices include a method using aquantization matrix which has been set directly at the encoder side anda method using a quantization matrix which has been set as a default(default matrix). At the encoder side, a quantization matrix suitablefor features of an image can be set by directly setting a quantizationmatrix. This case, however, has a disadvantage of increasing a codingamount for encoding the quantization matrix.

There is a method for quantizing a high-frequency coefficient and alow-frequency coefficient without using a quantization matrix. It is tobe noted that this method is equivalent to a method using a quantizationmatrix (flat matrix) whose coefficients have the same value.

The quantization matrix may be specified using, for example, a sequenceparameter set (SPS) or a picture parameter set (PPS). The SPS includes aparameter which is used for a sequence, and the PPS includes a parameterwhich is used for a picture. Each of the SPS and the PPS may be simplyreferred to as a parameter set.

[Entropy Encoder]

Entropy encoder 110 generates an encoded signal (encoded bitstream)based on quantized coefficients which have been input from quantizer108. More specifically, entropy encoder 110, for example, binarizesquantized coefficients, and arithmetically encodes the binary signal,and outputs a compressed bit stream or sequence.

[Inverse Quantizer]

Inverse quantizer 112 inverse quantizes quantized coefficients whichhave been input from quantizer 108. More specifically, inverse quantizer112 inverse quantizes, in a determined scanning order, quantizedcoefficients of the current block. Inverse quantizer 112 then outputsthe inverse quantized transform coefficients of the current block toinverse transformer 114. The determined scanning order may bepredetermined.

[Inverse Transformer]

Inverse transformer 114 restores prediction errors (residuals) byinverse transforming transform coefficients which have been input frominverse quantizer 112. More specifically, inverse transformer 114restores the prediction errors of the current block by applying aninverse transform corresponding to the transform applied by transformer106 on the transform coefficients. Inverse transformer 114 then outputsthe restored prediction errors to adder 116.

It is to be noted that since information is lost in quantization, therestored prediction errors do not match the prediction errors calculatedby subtractor 104. In other words, the restored prediction errorsnormally include quantization errors.

[Adder]

Adder 116 reconstructs the current block by adding prediction errorswhich have been input from inverse transformer 114 and predictionsamples which have been input from prediction controller 128. Adder 116then outputs the reconstructed block to block memory 118 and loop filter120. A reconstructed block is also referred to as a local decoded block.

[Block Memory]

Block memory 118 is, for example, storage for storing blocks in apicture to be encoded (hereinafter referred to as a current picture)which is referred to in intra prediction. More specifically, blockmemory 118 stores reconstructed blocks output from adder 116.

[Frame Memory]

Frame memory 122 is, for example, storage for storing reference picturesfor use in inter prediction, and is also referred to as a frame buffer.More specifically, frame memory 122 stores reconstructed blocks filteredby loop filter 120.

[Loop Filter]

Loop filter 120 applies a loop filter to blocks reconstructed by adder116, and outputs the filtered reconstructed blocks to frame memory 122.A loop filter is a filter used in an encoding loop (in-loop filter), andincludes, for example, a deblocking filter (DF or DBF), a sampleadaptive offset (SAO), and an adaptive loop filter (ALF).

In an ALF, a least square error filter for removing compressionartifacts is applied. For example, one filter selected from among aplurality of filters based on the direction and activity of localgradients is applied for each of 2×2 sub-blocks in the current block.

More specifically, first, each sub-block (for example, each 2×2sub-block) is categorized into one out of a plurality of classes (forexample, fifteen or twenty-five classes). The classification of thesub-block is based on gradient directionality and activity. For example,classification index C (for example, C=5D+A) is derived based ongradient directionality D (for example, 0 to 2 or 0 to 4) and gradientactivity A (for example, 0 to 4). Then, based on classification index C,each sub-block is categorized into one out of a plurality of classes.

For example, gradient directionality D is calculated by comparinggradients of a plurality of directions (for example, the horizontal,vertical, and two diagonal directions). Moreover, for example, gradientactivity A is calculated by adding gradients of a plurality ofdirections and quantizing the result of addition.

The filter to be used for each sub-block is determined from among theplurality of filters based on the result of such categorization.

The filter shape to be used in an ALF is, for example, a circularsymmetric filter shape. FIG. 6A through FIG. 6C illustrate examples offilter shapes used in ALFs. FIG. 6A illustrates a 5×5 diamond shapefilter, FIG. 6B illustrates a 7×7 diamond shape filter, and FIG. 6Cillustrates a 9×9 diamond shape filter. Information indicating thefilter shape is normally signaled at the picture level. It is to benoted that the signaling of such information indicating the filter shapedoes not necessarily need to be performed at the picture level, and maybe performed at another level (for example, at the sequence level, slicelevel, tile level, CTU level, or CU level).

The ON or OFF of the ALF is determined, for example, at the picturelevel or CU level. For example, the decision of whether to apply the ALFto luma may be made at the CU level, and the decision of whether toapply ALF to chroma may be made at the picture level. Informationindicating ON or OFF of the ALF is normally signaled at the picturelevel or CU level. It is to be noted that the signaling of informationindicating ON or OFF of the ALF does not necessarily need to beperformed at the picture level or CU level, and may be performed atanother level (for example, at the sequence level, slice level, tilelevel, or CTU level).

The coefficient set for the plurality of selectable filters (forexample, fifteen or up to twenty-five filters) is normally signaled atthe picture level. It is to be noted that the signaling of thecoefficient set does not necessarily need to be performed at the picturelevel, and may be performed at another level (for example, at thesequence level, slice level, tile level, CTU level, CU level, orsub-block level).

[Loop Filter>Deblocking Filter]

In a deblocking filter, loop filter 120 performs a filter process on ablock boundary in a reconstructed image so as to reduce distortion whichoccurs at the block boundary.

FIG. 7 is a block diagram illustrating one example of a specificconfiguration of loop filter 120 which functions as a deblocking filter.

Loop filter 120 includes: boundary determiner 1201; filter determiner1203; filtering executor 1205; process determiner 1208; filtercharacteristic determiner 1207; and switches 1202, 1204, and 1206.

Boundary determiner 1201 determines whether a pixel to bedeblock-filtered (that is, a current pixel) is present around a blockboundary. Boundary determiner 1201 then outputs the determination resultto switch 1202 and processing determiner 1208.

In the case where boundary determiner 1201 has determined that a currentpixel is present around a block boundary, switch 1202 outputs anunfiltered image to switch 1204. In the opposite case where boundarydeterminer 1201 has determined that no current pixel is present around ablock boundary, switch 1202 outputs an unfiltered image to switch 1206.

Filter determiner 1203 determines whether to perform deblockingfiltering of the current pixel, based on the pixel value of at least onesurrounding pixel located around the current pixel. Filter determiner1203 then outputs the determination result to switch 1204 and processingdeterminer 1208.

In the case where filter determiner 1203 has determined to performdeblocking filtering of the current pixel, switch 1204 outputs theunfiltered image obtained through switch 1202 to filtering executor1205. In the opposite case were filter determiner 1203 has determinednot to perform deblocking filtering of the current pixel, switch 1204outputs the unfiltered image obtained through switch 1202 to switch1206.

When obtaining the unfiltered image through switches 1202 and 1204,filtering executor 1205 executes, for the current pixel, deblockingfiltering with the filter characteristic determined by filtercharacteristic determiner 1207. Filtering executor 1205 then outputs thefiltered pixel to switch 1206.

Under control by processing determiner 1208, switch 1206 selectivelyoutputs a pixel which has not been deblock-filtered and a pixel whichhas been deblock-filtered by filtering executor 1205.

Processing determiner 1208 controls switch 1206 based on the results ofdeterminations made by boundary determiner 1201 and filter determiner1203. In other words, processing determiner 1208 causes switch 1206 tooutput the pixel which has been deblock-filtered when boundarydeterminer 1201 has determined that the current pixel is present aroundthe block boundary and filter determiner 1203 has determined to performdeblocking filtering of the current pixel. In addition, other than theabove case, processing determiner 1208 causes switch 1206 to output thepixel which has not been deblock-filtered. A filtered image is outputfrom switch 1206 by repeating output of a pixel in this way.

FIG. 8 is a conceptual diagram indicating an example of a deblockingfilter having a symmetrical filtering characteristic with respect to ablock boundary.

In a deblocking filter process, one of two deblocking filters havingdifferent characteristics, that is, a strong filter and a weak filter isselected using pixel values and quantization parameters. In the case ofthe strong filter, pixels p0 to p2 and pixels q0 to q2 are presentacross a block boundary as illustrated in FIG. 8 , the pixel values ofthe respective pixel q0 to q2 are changed to pixel values q′0 to q′2 byperforming, for example, computations according to the expressionsbelow.Q′0=(p1+2×p0+2×q0+2×q1+q2+4)/8Q′1=(p0+q0+q1+q2+2)/4Q′2=(p0+q0+q1+3×q2+2×q3+4)/8

It is to be noted that, in the above expressions, p0 to p2 and q0 to q2are the pixel values of respective pixels p0 to p2 and pixels q0 to q2.In addition, q3 is the pixel value of neighboring pixel q3 located atthe opposite side of pixel q2 with respect to the block boundary. Inaddition, in the right side of each of the expressions, coefficientswhich are multiplied with the respective pixel values of the pixels tobe used for deblocking filtering are filter coefficients.

Furthermore, in the deblocking filtering, clipping may be performed sothat the calculated pixel values are not set over a threshold value. Inthe clipping process, the pixel values calculated according to the aboveexpressions are clipped to a value obtained according to “a computationpixel value±2× a threshold value” using the threshold value determinedbased on a quantization parameter. In this way, it is possible toprevent excessive smoothing.

FIG. 9 is a conceptual diagram for illustrating a block boundary onwhich a deblocking filter process is performed. FIG. 10 is a conceptualdiagram indicating examples of Bs values.

The block boundary on which the deblocking filter process is performedis, for example, a boundary between prediction units (PU) having 8×8pixel blocks as illustrated in FIG. 9 or a boundary between transformunits (TU). The deblocking filter process may be performed in units offour rows or four columns. First, boundary strength (Bs) values aredetermined as indicated in FIG. 10 for block P and block Q illustratedin FIG. 9 .

According to the Bs values in FIG. 10 , whether to perform deblockingfilter processes of block boundaries belonging to the same image usingdifferent strengths is determined. The deblocking filter process for achroma signal is performed when a Bs value is 2. The deblocking filterprocess for a luma signal is performed when a Bs value is 1 or more anda determined condition is satisfied. The determined condition may bepredetermined. It is to be noted that conditions for determining Bsvalues are not limited to those indicated in FIG. 10 , and a Bs valuemay be determined based on another parameter.

[Prediction Processor (Intra Predictor, Inter Predictor, PredictionController)]

FIG. 11 is a flow chart illustrating one example of a process performedby the prediction processor of encoder 100. It is to be noted that theprediction processor includes all or part of the following constituentelements: intra predictor 124; inter predictor 126; and predictioncontroller 128.

The prediction processor generates a prediction image of a current block(Step Sb_1). This prediction image is also referred to as a predictionsignal or a prediction block. It is to be noted that the predictionsignal is, for example, an intra prediction signal or an interprediction signal. Specifically, the prediction processor generates theprediction image of the current block using a reconstructed image whichhas been already obtained through generation of a prediction block,generation of a difference block, generation of a coefficient block,restoring of a difference block, and generation of a decoded imageblock.

The reconstructed image may be, for example, an image in a referencepicture, or an image of an encoded block in a current picture which isthe picture including the current block. The encoded block in thecurrent picture is, for example, a neighboring block of the currentblock.

FIG. 12 is a flow chart illustrating another example of a processperformed by the prediction processor of encoder 100.

The prediction processor generates a prediction image using a firstmethod (Step Sc_1 a), generates a prediction image using a second method(Step Sc_1 b), and generates a prediction image using a third method(Step Sc_1 c). The first method, the second method, and the third methodmay be mutually different methods for generating a prediction image.Each of the first to third methods may be an inter prediction method, anintra prediction method, or another prediction method. Theabove-described reconstructed image may be used in these predictionmethods.

Next, the prediction processor selects any one of a plurality ofprediction methods generated in Steps Sc_1 a, Sc_1 b, and Sc_1 c (StepSc_2). The selection of the prediction image, that is selection of amethod or a mode for obtaining a final prediction image may be made bycalculating a cost for each of the generated prediction images and basedon the cost. Alternatively, the selection of the prediction image may bemade based on a parameter which is used in an encoding process. Encoder100 may transform information for identifying a selected predictionimage, a method, or a mode into an encoded signal (also referred to asan encoded bitstream). The information may be, for example, a flag orthe like. In this way, the decoder is capable of generating a predictionimage according to the method or the mode selected based on theinformation in encoder 100. It is to be noted that, in the exampleillustrated in FIG. 12 , the prediction processor selects any of theprediction images after the prediction images are generated using therespective methods. However, the prediction processor may select amethod or a mode based on a parameter for use in the above-describedencoding process before generating prediction images, and may generate aprediction image according to the method or mode selected.

For example, the first method and the second method may be intraprediction and inter prediction, respectively, and the predictionprocessor may select a final prediction image for a current block fromprediction images generated according to the prediction methods.

FIG. 13 is a flow chart illustrating another example of a processperformed by the prediction processor of encoder 100.

First, the prediction processor generates a prediction image using intraprediction (Step Sd_1 a), and generates a prediction image using interprediction (Step Sd_1 b). It is to be noted that the prediction imagegenerated by intra prediction is also referred to as an intra predictionimage, and the prediction image generated by inter prediction is alsoreferred to as an inter prediction image.

Next, the prediction processor evaluates each of the intra predictionimage and the inter prediction image (Step Sd_2). A cost may be used inthe evaluation. In other words, the prediction processor calculates costC for each of the intra prediction image and the inter prediction image.Cost C may be calculated according to an expression of an R-Doptimization model, for example, C=D+λ×R. In this expression, Dindicates a coding distortion of a prediction image, and is representedas, for example, a sum of absolute differences between the pixel valueof a current block and the pixel value of a prediction image. Inaddition, R indicates a predicted coding amount of a prediction image,specifically, the coding amount required to encode motion informationfor generating a prediction image, etc. In addition, λ indicates, forexample, a multiplier according to the method of Lagrange multiplier.

The prediction processor then selects the prediction image for which thesmallest cost C has been calculated among the intra prediction image andthe inter prediction image, as the final prediction image for thecurrent block (Step Sd_3). In other words, the prediction method or themode for generating the prediction image for the current block isselected.

[Intra Predictor]

Intra predictor 124 generates a prediction signal (intra predictionsignal) by performing intra prediction (also referred to as intra frameprediction) of the current block by referring to a block or blocks inthe current picture and stored in block memory 118. More specifically,intra predictor 124 generates an intra prediction signal by performingintra prediction by referring to samples (for example, luma and/orchroma values) of a block or blocks neighboring the current block, andthen outputs the intra prediction signal to prediction controller 128.

For example, intra predictor 124 performs intra prediction by using onemode from among a plurality of intra prediction modes which have beendefined. The intra prediction modes include one or more non-directionalprediction modes and a plurality of directional prediction modes. Thedefined modes may be predefined.

The one or more non-directional prediction modes include, for example,the planar prediction mode and DC prediction mode defined in theH.265/high-efficiency video coding (HEVC) standard.

The plurality of directional prediction modes include, for example, thethirty-three directional prediction modes defined in the H.265/HEVCstandard. It is to be noted that the plurality of directional predictionmodes may further include thirty-two directional prediction modes inaddition to the thirty-three directional prediction modes (for a totalof sixty-five directional prediction modes). FIG. 14 is a conceptualdiagram illustrating sixty-seven intra prediction modes in total thatmay be used in intra prediction (two non-directional prediction modesand sixty-five directional prediction modes). The solid arrows representthe thirty-three directions defined in the H.265/HEVC standard, and thedashed arrows represent the additional thirty-two directions (the twonon-directional prediction modes are not illustrated in FIG. 14 ).

In various kinds of processing examples, a luma block may be referred toin intra prediction of a chroma block. In other words, a chromacomponent of the current block may be predicted based on a lumacomponent of the current block. Such intra prediction is also referredto as cross-component linear model (CCLM) prediction. The intraprediction mode for a chroma block in which such a luma block isreferred to (also referred to as, for example, a CCLM mode) may be addedas one of the intra prediction modes for chroma blocks.

Intra predictor 124 may correct intra-predicted pixel values based onhorizontal/vertical reference pixel gradients. Intra predictionaccompanied by this sort of correcting is also referred to as positiondependent intra prediction combination (PDPC). Information indicatingwhether to apply PDPC (referred to as, for example, a PDPC flag) isnormally signaled at the CU level. It is to be noted that the signalingof such information does not necessarily need to be performed at the CUlevel, and may be performed at another level (for example, at thesequence level, picture level, slice level, tile level, or CTU level).

[Inter Predictor]

Inter predictor 126 generates a prediction signal (inter predictionsignal) by performing inter prediction (also referred to as inter frameprediction) of the current block by referring to a block or blocks in areference picture, which is different from the current picture and isstored in frame memory 122. Inter prediction is performed in units of acurrent block or a current sub-block (for example, a 4×4 block) in thecurrent block. For example, inter predictor 126 performs motionestimation in a reference picture for the current block or the currentsub-block, and finds out a reference block or a sub-block which bestmatches the current block or the current sub-block. Inter predictor 126then obtains motion information (for example, a motion vector) whichcompensates a motion or a change from the reference block or thesub-block to the current block or the sub-block. Inter predictor 126generates an inter prediction signal of the current block or thesub-block by performing motion compensation (or motion prediction) basedon the motion information. Inter predictor 126 outputs the generatedinter prediction signal to prediction controller 128.

The motion information used in motion compensation may be signaled asinter prediction signals in various forms. For example, a motion vectormay be signaled. As another example, the difference between a motionvector and a motion vector predictor may be signaled.

[Basic Flow of Inter Prediction]

FIG. 15 is a flow chart illustrating an example basic processing flow ofinter prediction.

First, inter predictor 126 generates a prediction signal (Steps Se_1 toSe_3). Next, subtractor 104 generates the difference between a currentblock and a prediction image as a prediction residual (Step Se_4). Here,in the generation of the prediction image, inter predictor 126 generatesthe prediction image through determination of a motion vector (MV) ofthe current block (Steps Se_1 and Se_2) and motion compensation (StepSe_3). Furthermore, in determination of an MV, inter predictor 126determines the MV through selection of a motion vector candidate (MVcandidate) (Step Se_1) and derivation of an MV (Step Se_2). Theselection of the MV candidate is made by, for example, selecting atleast one MV candidate from an MV candidate list. Alternatively, inderivation of an MV, inter predictor 126 may further select at least oneMV candidate from the at least one MV candidate, and determine theselected at least one MV candidate as the MV for the current block.Alternatively, inter predictor 126 may determine the MV for the currentblock by performing estimation in a reference picture region specifiedby each of the selected at least one MV candidate. It is to be notedthat the estimation in a reference picture region may be referred to asmotion estimation.

In addition, although Steps Se_1 to Se_3 are performed by interpredictor 126 in the above-described example, a process that is forexample Step Se_1, Step Se_2, or the like may be performed by anotherconstituent element included in encoder 100.

[Motion Vector Derivation Flow]

FIG. 16 is a flow chart illustrating one example of derivation of motionvectors.

Inter predictor 126 derives an MV of a current block in a mode forencoding motion information (for example, an MV). In this case, forexample, the motion information is encoded as a prediction parameter,and is signaled. In other words, the encoded motion information isincluded in an encoded signal (also referred to as an encodedbitstream).

Alternatively, inter predictor 126 derives an MV in a mode in whichmotion information is not encoded. In this case, no motion informationis included in an encoded signal.

Here, MV derivation modes may include a normal inter mode, a merge mode,a FRUC mode, an affine mode, etc., which are described later. Modes inwhich motion information is encoded among the modes include the normalinter mode, the merge mode, the affine mode (specifically, an affineinter mode and an affine merge mode), etc. It is to be noted that motioninformation may include not only an MV but also motion vector predictorselection information which is described later. Modes in which no motioninformation is encoded include the FRUC mode, etc. Inter predictor 126selects a mode for deriving an MV of the current block from the modes,and derives the MV of the current block using the selected mode.

FIG. 17 is a flow chart illustrating another example of derivation ofmotion vectors.

Inter predictor 126 derives an MV of a current block in a mode in whichan MV difference is encoded. In this case, for example, the MVdifference is encoded as a prediction parameter, and is signaled. Inother words, the encoded MV difference is included in an encoded signal.The MV difference is the difference between the MV of the current blockand the MV predictor.

Alternatively, inter predictor 126 derives an MV in a mode in which noMV difference is encoded. In this case, no encoded MV difference isincluded in an encoded signal.

Here, as described above, the MV derivation modes include the normalinter mode, the merge mode, the FRUC mode, the affine mode, etc., whichare described later. Modes in which an MV difference is encoded amongthe modes include the normal inter mode, the affine mode (specifically,the affine inter mode), etc. Modes in which no MV difference is encodedinclude the FRUC mode, the merge mode, the affine mode (specifically,the affine merge mode), etc. Inter predictor 126 selects a mode forderiving an MV of the current block from the plurality of modes, andderives the MV of the current block using the selected mode.

[Motion Vector Derivation Flow]

FIG. 18 is a flow chart illustrating another example of derivation ofmotion vectors. The MV derivation modes which are inter prediction modesinclude a plurality of modes and are roughly divided into modes in whichan MV difference is encoded and modes in which no motion vectordifference is encoded. The modes in which no MV difference is encodedinclude the merge mode, the FRUC mode, the affine mode (specifically,the affine merge mode), etc. These modes are described in detail later.Simply, the merge mode is a mode for deriving an MV of a current blockby selecting a motion vector from an encoded surrounding block, and theFRUC mode is a mode for deriving an MV of a current block by performingestimation between encoded regions. The affine mode is a mode forderiving, as an MV of a current block, a motion vector of each of aplurality of sub-blocks included in the current block, assuming affinetransform.

More specifically, as illustrated when the inter prediction modeinformation indicates 0 (0 in Sf_1), inter predictor 126 derives amotion vector using the merge mode (Sf_2). When the inter predictionmode information indicates 1 (1 in Sf_1), inter predictor 126 derives amotion vector using the FRUC mode (Sf_3). When the inter prediction modeinformation indicates 2 (2 in Sf_1), inter predictor 126 derives amotion vector using the affine mode (specifically, the affine mergemode) (Sf_4). When the inter prediction mode information indicates 3 (3in Sf_1), inter predictor 126 derives a motion vector using a mode inwhich an MV difference is encoded (for example, a normal inter mode(Sf_5).

[MV Derivation>Normal Inter Mode]

The normal inter mode is an inter prediction mode for deriving an MV ofa current block based on a block similar to the image of the currentblock from a reference picture region specified by an MV candidate. Inthis normal inter mode, an MV difference is encoded.

FIG. 19 is a flow chart illustrating an example of inter prediction innormal inter mode.

First, inter predictor 126 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of encodedblocks temporally or spatially surrounding the current block (StepSg_1). In other words, inter predictor 126 generates an MV candidatelist.

Next, inter predictor 126 extracts N (an integer of 2 or larger) MVcandidates from the plurality of MV candidates obtained in Step Sg_1, asmotion vector predictor candidates (also referred to as MV predictorcandidates) according to a determined priority order (Step Sg_2). It isto be noted that the priority order may be determined in advance foreach of the N MV candidates.

Next, inter predictor 126 selects one motion vector predictor candidatefrom the N motion vector predictor candidates, as the motion vectorpredictor (also referred to as an MV predictor) of the current block(Step Sg_3). At this time, inter predictor 126 encodes, in a stream,motion vector predictor selection information for identifying theselected motion vector predictor. It is to be noted that the stream isan encoded signal or an encoded bitstream as described above.

Next, inter predictor 126 derives an MV of a current block by referringto an encoded reference picture (Step Sg_4). At this time, interpredictor 126 further encodes, in the stream, the difference valuebetween the derived MV and the motion vector predictor as an MVdifference. It is to be noted that the encoded reference picture is apicture including a plurality of blocks which have been reconstructedafter being encoded.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the encoded reference picture (Step Sg_5). It is to benoted that the prediction image is an inter prediction signal asdescribed above.

In addition, information indicating the inter prediction mode (normalinter mode in the above example) used to generate the prediction imageis, for example, encoded as a prediction parameter.

It is to be noted that the MV candidate list may be also used as a listfor use in another mode. In addition, the processes related to the MVcandidate list may be applied to processes related to the list for usein another mode. The processes related to the MV candidate list include,for example, extraction or selection of an MV candidate from the MVcandidate list, reordering of MV candidates, or deletion of an MVcandidate.

[MV Derivation>Merge Mode]

The merge mode is an inter prediction mode for selecting an MV candidatefrom an MV candidate list as an MV of a current block, thereby derivingthe MV.

FIG. 20 is a flow chart illustrating an example of inter prediction inmerge mode.

First, inter predictor 126 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of encodedblocks temporally or spatially surrounding the current block (StepSh_1). In other words, inter predictor 126 generates an MV candidatelist.

Next, inter predictor 126 selects one MV candidate from the plurality ofMV candidates obtained in Step Sh_1, thereby deriving an MV of thecurrent block (Step Sh_2). At this time, inter predictor 126 encodes, ina stream, MV selection information for identifying the selected MVcandidate.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the encoded reference picture (Step Sh_3).

In addition, information indicating the inter prediction mode (mergemode in the above example) used to generate the prediction image andincluded in the encoded signal is, for example, encoded as a predictionparameter.

FIG. 21 is a conceptual diagram for illustrating one example of a motionvector derivation process of a current picture in merge mode.

First, an MV candidate list in which MV predictor candidates areregistered is generated. Examples of MV predictor candidates include:spatially neighboring MV predictors which are MVs of a plurality ofencoded blocks located spatially surrounding a current block; temporallyneighboring MV predictors which are MVs of surrounding blocks on whichthe position of a current block in an encoded reference picture isprojected; combined MV predictors which are MVs generated by combiningthe MV value of a spatially neighboring MV predictor and the MV of atemporally neighboring MV predictor; and a zero MV predictor which is anMV having a zero value.

Next, one MV predictor is selected from a plurality of MV predictorsregistered in an MV predictor list, and the selected MV predictor isdetermined as the MV of a current block.

Furthermore, the variable length encoder describes and encodes, in astream, merge_idx which is a signal indicating which MV predictor hasbeen selected.

It is to be noted that the MV predictors registered in the MV predictorlist described in FIG. 21 are examples. The number of MV predictors maybe different from the number of MV predictors in the diagram, the MVpredictor list may be configured in such a manner that some of the kindsof the MV predictors in the diagram may not be included, or that one ormore MV predictors other than the kinds of MV predictors in the diagramare included.

A final MV may be determined by performing a decoder motion vectorrefinement process (DMVR) to be described later using the MV of thecurrent block derived in merge mode.

It is to be noted that the MV predictor candidates are MV candidatesdescribed above, and the MV predictor list is the MV candidate listdescribed above. It is to be noted that the MV candidate list may bereferred to as a candidate list. In addition, merge_idx is MV selectioninformation.

[MV Derivation>FRUC Mode]

Motion information may be derived at the decoder side without beingsignaled from the encoder side. It is to be noted that, as describedabove, the merge mode defined in the H.265/HEVC standard may be used. Inaddition, for example, motion information may be derived by performingmotion estimation at the decoder side. In an embodiment, at the decoderside, motion estimation is performed without using any pixel value in acurrent block.

Here, a mode for performing motion estimation at the decoder side isdescribed. The mode for performing motion estimation at the decoder sidemay be referred to as a pattern matched motion vector derivation (PMMVD)mode, or a frame rate up-conversion (FRUC) mode.

One example of a FRUC process in the form of a flow chart is illustratedin FIG. 22 . First, a list of a plurality of candidates each having amotion vector (MV) predictor (that is, an MV candidate list that may bealso used as a merge list) is generated by referring to a motion vectorin an encoded block which spatially or temporally neighbors a currentblock (Step Si_1). Next, a best MV candidate is selected from theplurality of MV candidates registered in the MV candidate list (StepSi_2). For example, the evaluation values of the respective MVcandidates included in the MV candidate list are calculated, and one MVcandidate is selected based on the evaluation values. Based on theselected motion vector candidates, a motion vector for the current blockis then derived (Step Si_4). More specifically, for example, theselected motion vector candidate (best MV candidate) is derived directlyas the motion vector for the current block. In addition, for example,the motion vector for the current block may be derived using patternmatching in a surrounding region of a position in a reference picturewhere the position in the reference picture corresponds to the selectedmotion vector candidate. In other words, estimation using the patternmatching and the evaluation values may be performed in the surroundingregion of the best MV candidate, and when there is an MV that yields abetter evaluation value, the best MV candidate may be updated to the MVthat yields the better evaluation value, and the updated MV may bedetermined as the final MV for the current block. A configuration inwhich no such a process for updating the best MV candidate to the MVhaving a better evaluation value is performed is also possible.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the encoded reference picture (Step Si_5).

A similar process may be performed in units of a sub-block.

Evaluation values may be calculated according to various kinds ofmethods. For example, a comparison is made between a reconstructed imagein a region in a reference picture corresponding to a motion vector anda reconstructed image in a determined region (the region may be, forexample, a region in another reference picture or a region in aneighboring block of a current picture, as indicated below). Thedetermined region may be predetermined.

The difference between the pixel values of the two reconstructed imagesmay be used for an evaluation value of the motion vectors. It is to benoted that an evaluation value may be calculated using information otherthan the value of the difference.

Next, an example of pattern matching is described in detail. First, oneMV candidate included in an MV candidate list (for example, a mergelist) is selected as a start point of estimation by the patternmatching. For example, as the pattern matching, either a first patternmatching or a second pattern matching may be used. The first patternmatching and the second pattern matching are also referred to asbilateral matching and template matching, respectively.

[MV Derivation>FRUC>Bilateral Matching]

In the first pattern matching, pattern matching is performed between twoblocks along a motion trajectory of a current block which are two blocksin different two reference pictures. Accordingly, in the first patternmatching, a region in another reference picture along the motiontrajectory of the current block is used as a determined region forcalculating the evaluation value of the above-described candidate. Thedetermined region may be predetermined.

FIG. 23 is a conceptual diagram for illustrating one example of thefirst pattern matching (bilateral matching) between the two blocks inthe two reference pictures along the motion trajectory. As illustratedin FIG. 23 , in the first pattern matching, two motion vectors (MV0,MV1) are derived by estimating a pair which best matches among pairs inthe two blocks in the two different reference pictures (Ref0, Ref1)which are the two blocks along the motion trajectory of the currentblock (Cur block). More specifically, a difference between thereconstructed image at a specified location in the first encodedreference picture (Ref0) specified by an MV candidate and thereconstructed image at a specified location in the second encodedreference picture (Ref1) specified by a symmetrical MV obtained byscaling the MV candidate at a display time interval is derived for thecurrent block, and an evaluation value is calculated using the value ofthe obtained difference. It is possible to select, as the final MV, theMV candidate which yields the best evaluation value among the pluralityof MV candidates, and which is likely to produce good results.

In the assumption of a continuous motion trajectory, the motion vectors(MV0, MV1) specifying the two reference blocks are proportional totemporal distances (TD0, TD1) between the current picture (Cur Pic) andthe two reference pictures (Ref0, Ref1). For example, when the currentpicture is temporally located between the two reference pictures and thetemporal distances from the current picture to the respective tworeference pictures are equal to each other, mirror-symmetricalbi-directional motion vectors are derived in the first pattern matching.

[MV Derivation>FRUC>Template Matching]

In the second pattern matching (template matching), pattern matching isperformed between a block in a reference picture and a template in thecurrent picture (the template is a block neighboring the current blockin the current picture (the neighboring block is, for example, an upperand/or left neighboring block(s))). Accordingly, in the second patternmatching, the block neighboring the current block in the current pictureis used as the determined region for calculating the evaluation value ofthe above-described candidate.

FIG. 24 is a conceptual diagram for illustrating one example of patternmatching (template matching) between a template in a current picture anda block in a reference picture. As illustrated in FIG. 24 , in thesecond pattern matching, the motion vector of the current block (Curblock) is derived by estimating, in the reference picture (Ref0), theblock which best matches the block neighboring the current block in thecurrent picture (Cur Pic). More specifically, it is possible that thedifference between a reconstructed image in an encoded region whichneighbors both left and above or either left or above and areconstructed image which is in a corresponding region in the encodedreference picture (Ref0) and is specified by an MV candidate is derived,an evaluation value is calculated using the value of the obtaineddifference, and the MV candidate which yields the best evaluation valueamong a plurality of MV candidates is selected as the best MV candidate.

Such information indicating whether to apply the FRUC mode (referred toas, for example, a FRUC flag) may be signaled at the CU level. Inaddition, when the FRUC mode is applied (for example, when a FRUC flagis true), information indicating an applicable pattern matching method(either the first pattern matching or the second pattern matching) maybe signaled at the CU level. It is to be noted that the signaling ofsuch information does not necessarily need to be performed at the CUlevel, and may be performed at another level (for example, at thesequence level, picture level, slice level, tile level, CTU level, orsub-block level).

[MV Derivation>Affine Mode]

Next, the affine mode for deriving a motion vector in units of asub-block based on motion vectors of a plurality of neighboring blocksis described. This mode is also referred to as an affine motioncompensation prediction mode.

FIG. 25A is a conceptual diagram for illustrating one example ofderiving a motion vector of each sub-block based on motion vectors of aplurality of neighboring blocks. In FIG. 25A, the current block includessixteen 4×4 sub-blocks. Here, motion vector V₀ at an upper-left cornercontrol point in the current block is derived based on a motion vectorof a neighboring block, and likewise, motion vector V₁ at an upper-rightcorner control point in the current block is derived based on a motionvector of a neighboring sub-block. Two motion vectors v₀ and v₁ may beprojected according to an expression (1A) indicated below, and motionvectors (v_(x), v_(y)) for the respective sub-blocks in the currentblock may be derived.

[Math.1] $\begin{matrix}\left\{ \begin{matrix}{v_{x} = {{\frac{\left( {v_{1x} - v_{0x}} \right)}{w}x} - {\frac{\left( {v_{1y} - v_{0y}} \right)}{w}y} + v_{0x}}} \\{v_{y} = {{\frac{\left( {v_{1y} - v_{0y}} \right)}{w}x} - {\frac{\left( {v_{1x} - v_{0x}} \right)}{w}y} + v_{0y}}}\end{matrix} \right. & \left( {1A} \right)\end{matrix}$

Here, x and y indicate the horizontal position and the vertical positionof the sub-block, respectively, and w indicates a determined weightingcoefficient. The determined weighting coefficient may be predetermined.

Such information indicating the affine mode (for example, referred to asan affine flag) may be signaled at the CU level. It is to be noted thatthe signaling of the information indicating the affine mode does notnecessarily need to be performed at the CU level, and may be performedat another level (for example, at the sequence level, picture level,slice level, tile level, CTU level, or sub-block level).

In addition, the affine mode may include several modes for differentmethods for deriving motion vectors at the upper-left and upper-rightcorner control points. For example, the affine mode include two modeswhich are the affine inter mode (also referred to as an affine normalinter mode) and the affine merge mode.

[MV Derivation>Affine Mode]

FIG. 25B is a conceptual diagram for illustrating one example ofderiving a motion vector of each sub-block in affine mode in which threecontrol points are used. In FIG. 25B, the current block includes sixteen4×4 blocks. Here, motion vector V₀ at the upper-left corner controlpoint for the current block is derived based on a motion vector of aneighboring block, and likewise, motion vector V₁ at the upper-rightcorner control point for the current block is derived based on a motionvector of a neighboring block, and motion vector V₂ at the lower-leftcorner control point for the current block is derived based on a motionvector of a neighboring block. Three motion vectors v₀, v₁, and v₂ maybe projected according to an expression (1B) indicated below, and motionvectors (v_(x), v_(y)) for the respective sub-blocks in the currentblock may be derived.

[Math.2] $\begin{matrix}\left\{ \begin{matrix}{v_{x} = {{\frac{\left( {v_{1x} - v_{0x}} \right)}{w}x} - {\frac{\left( {v_{2x} - v_{0x}} \right)}{h}y} + v_{0x}}} \\{v_{y} = {{\frac{\left( {v_{1y} - v_{0y}} \right)}{w}x} - {\frac{\left( {v_{2y} - v_{0y}} \right)}{h}y} + v_{0y}}}\end{matrix} \right. & \left( {1B} \right)\end{matrix}$

Here, x and y indicate the horizontal position and the vertical positionof the center of the sub-block, respectively, w indicates the width ofthe current block, and h indicates the height of the current block.

Affine modes in which different numbers of control points (for example,two and three control points) are used may be switched and signaled atthe CU level. It is to be noted that information indicating the numberof control points in affine mode used at the CU level may be signaled atanother level (for example, the sequence level, picture level, slicelevel, tile level, CTU level, or sub-block level).

In addition, such an affine mode in which three control points are usedmay include different methods for deriving motion vectors at theupper-left, upper-right, and lower-left corner control points. Forexample, the affine modes include two modes which are the affine intermode (also referred to as the affine normal inter mode) and the affinemerge mode.

[MV Derivation>Affine Merge Mode]

FIG. 26A, FIG. 26B, and FIG. 26C are conceptual diagrams forillustrating the affine merge mode.

As illustrated in FIG. 26A, in the affine merge mode, for example,motion vector predictors at respective control points of a current blockare calculated based on a plurality of motion vectors corresponding toblocks encoded according to the affine mode among encoded block A(left), block B (upper), block C (upper-right), block D (lower-left),and block E (upper-left) which neighbor the current block. Morespecifically, encoded block A (left), block B (upper), block C(upper-right), block D (lower-left), and block E (upper-left) arechecked in the listed order, and the first effective block encodedaccording to the affine mode is identified. Motion vector predictors atthe control points of the current block are calculated based on aplurality of motion vectors corresponding to the identified block.

For example, as illustrated in FIG. 26B, when block A which neighbors tothe left of the current block has been encoded according to an affinemode in which two control points are used, motion vectors v₃ and v₄projected at the upper-left corner position and the upper-right cornerposition of the encoded block including block A are derived. Motionvector predictor v₀ at the upper-left corner control point of thecurrent block and motion vector predictor v₁ at the upper-right cornercontrol point of the current block are then calculated from derivedmotion vectors v₃ and v₄.

For example, as illustrated in FIG. 26C, when block A which neighbors tothe left of the current block has been encoded according to an affinemode in which three control points are used, motion vectors v₃, v₄, andv₅ projected at the upper-left corner position, the upper-right cornerposition, and the lower-left corner position of the encoded blockincluding block A are derived. Motion vector predictor v₀ at theupper-left corner control point of the current block, motion vectorpredictor v₁ at the upper-right corner control point of the currentblock, and motion vector predictor v₂ at the lower-left corner controlpoint of the current block are then calculated from derived motionvectors v₃, v₄, and v₅.

It is to be noted that this method for deriving motion vector predictorsmay be used to derive motion vector predictors of the respective controlpoints of the current block in Step Sj_1 in FIG. 29 described later.

FIG. 27 is a flow chart illustrating one example of the affine mergemode.

In affine merge mode as illustrated, first, inter predictor 126 derivesMV predictors of respective control points of a current block (StepSk_1). The control points are an upper-left corner point of the currentblock and an upper-right corner point of the current block asillustrated in FIG. 25A, or an upper-left corner point of the currentblock, an upper-right corner point of the current block, and alower-left corner point of the current block as illustrated in FIG. 25B.

In other words, as illustrated in FIG. 26A, inter predictor 126 checksencoded block A (left), block B (upper), block C (upper-right), block D(lower-left), and block E (upper-left) in the listed order, andidentifies the first effective block encoded according to the affinemode.

When block A is identified and block A has two control points, asillustrated in FIG. 26B, inter predictor 126 calculates motion vector v₀at the upper-left corner control point of the current block and motionvector v₁ at the upper-right corner control point of the current blockfrom motion vectors v₃ and v₄ at the upper-left corner and theupper-right corner of the encoded block including block A. For example,inter predictor 126 calculates motion vector v₀ at the upper-left cornercontrol point of the current block and motion vector v₁ at theupper-right corner control point of the current block by projectingmotion vectors v₃ and v₄ at the upper-left corner and the upper-rightcorner of the encoded block onto the current block.

Alternatively, when block A is identified and block A has three controlpoints, as illustrated in FIG. 26C, inter predictor 126 calculatesmotion vector v₀ at the upper-left corner control point of the currentblock, motion vector v₁ at the upper-right corner control point of thecurrent block, and motion vector v₂ at the lower-left corner controlpoint of the current block from motion vectors v₃, v₄, and v₅ at theupper-left corner, the upper-right corner, and the lower-left corner ofthe encoded block including block A. For example, inter predictor 126calculates motion vector v₀ at the upper-left corner control point ofthe current block, motion vector v₁ at the upper-right corner controlpoint of the current block, and motion vector v₂ at the lower-leftcorner control point of the current block by projecting motion vectorsv₃, v₄, and v₅ at the upper-left corner, the upper-right corner, and thelower-left corner of the encoded block onto the current block.

Next, inter predictor 126 performs motion compensation of each of aplurality of sub-blocks included in the current block. In other words,inter predictor 126 calculates, for each of the plurality of sub-blocks,a motion vector of the sub-block as an affine MV, by using either (i)two motion vector predictors v₀ and v₁ and the expression (1A) describedabove or (ii) three motion vector predictors v₀, v₁, and v₂ and theexpression (1B) described above (Step Sk_2). Inter predictor 126 thenperforms motion compensation of the sub-blocks using these affine MVsand encoded reference pictures (Step Sk_3). As a result, motioncompensation of the current block is performed to generate a predictionimage of the current block.

[MV Derivation>Affine Inter Mode]

FIG. 28A is a conceptual diagram for illustrating an affine inter modein which two control points are used.

In the affine inter mode, as illustrated in FIG. 28A, a motion vectorselected from motion vectors of encoded block A, block B, and block Cwhich neighbor the current block is used as motion vector predictor v₀at the upper-left corner control point of the current block. Likewise, amotion vector selected from motion vectors of encoded block D and blockE which neighbor the current block is used as motion vector predictor v₁at the upper-right corner control point of the current block.

FIG. 28B is a conceptual diagram for illustrating an affine inter modein which three control points are used.

In the affine inter mode, as illustrated in FIG. 28B, a motion vectorselected from motion vectors of encoded block A, block B, and block Cwhich neighbor the current block is used as motion vector predictor v₀at the upper-left corner control point of the current block. Likewise, amotion vector selected from motion vectors of encoded block D and blockE which neighbor the current block is used as motion vector predictor v₁at the upper-right corner control point of the current block.Furthermore, a motion vector selected from motion vectors of encodedblock F and block G which neighbor the current block is used as motionvector predictor v₂ at the lower-left corner control point of thecurrent block.

FIG. 29 is a flow chart illustrating one example of an affine intermode.

In the affine inter mode as illustrated, first, inter predictor 126derives MV predictors (v₀, v₁) or (v₀, v₁, v₂) of respective two orthree control points of a current block (Step Sj_1). The control pointsare an upper-left corner point of the current block and an upper-rightcorner point of the current block as illustrated in FIG. 25A, or anupper-left corner point of the current block, an upper-right cornerpoint of the current block, and a lower-left corner point of the currentblock as illustrated in FIG. 25B.

In other words, inter predictor 126 derives the motion vector predictors(v₀, v₁) or (v₀, v₁, v₂) of respective two or three control points ofthe current block by selecting motion vectors of any of the blocks amongencoded blocks in the vicinity of the respective control points of thecurrent block illustrated in either FIG. 28A or FIG. 28B. At this time,inter predictor 126 encodes, in a stream, motion vector predictorselection information for identifying the selected two motion vectors.

For example, inter predictor 126 may determine, using a cost evaluationor the like, the block from which a motion vector as a motion vectorpredictor at a control point is selected from among encoded blocksneighboring the current block, and may describe, in a bitstream, a flagindicating which motion vector predictor has been selected.

Next, inter predictor 126 performs motion estimation (Step Sj_3 andSj_4) while updating a motion vector predictor selected or derived inStep Sj_1 (Step Sj_2). In other words, inter predictor 126 calculates,as an affine MV, a motion vector of each of sub-blocks which correspondsto an updated motion vector predictor, using either the expression (1A)or expression (1B) described above (Step Sj_3). Inter predictor 126 thenperforms motion compensation of the sub-blocks using these affine MVsand encoded reference pictures (Step Sj_4). As a result, for example,inter predictor 126 determines the motion vector predictor which yieldsthe smallest cost as the motion vector at a control point in a motionestimation loop (Step Sj_5). At this time, inter predictor 126 furtherencodes, in the stream, the difference value between the determined MVand the motion vector predictor as an MV difference.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thedetermined MV and the encoded reference picture (Step Sj_6).

[MV Derivation>Affine Inter Mode]

When affine modes in which different numbers of control points (forexample, two and three control points) are used may be switched andsignaled at the CU level, the number of control points in an encodedblock and the number of control points in a current block may bedifferent from each other. FIG. 30A and FIG. 30B are conceptual diagramsfor illustrating methods for deriving motion vector predictors atcontrol points when the number of control points in an encoded block andthe number of control points in a current block are different from eachother. For example, as illustrated in FIG. 30A, when a current block hasthree control points at the upper-left corner, the upper-right corner,and the lower-left corner, and block A which neighbors to the left ofthe current block has been encoded according to an affine mode in whichtwo control points are used, motion vectors v₃ and v₄ projected at theupper-left corner position and the upper-right corner position in theencoded block including block A are derived. Motion vector predictor v₀at the upper-left corner control point of the current block and motionvector predictor v₁ at the upper-right corner control point of thecurrent block are then calculated from derived motion vectors v₃ and v₄.Furthermore, motion vector predictor v₂ at the lower-left corner controlpoint is calculated from derived motion vectors v₀ and v₁.

For example, as illustrated in FIG. 30B, when a current block has twocontrol points at the upper-left corner and the upper-right corner, andblock A which neighbors to the left of the current block has beenencoded according to the affine mode in which three control points areused, motion vectors v₃, v₄, and v₅ projected at the upper-left cornerposition, the upper-right corner position, and the lower-left cornerposition in the encoded block including block A are derived. Motionvector predictor v₀ at the upper-left corner control point of thecurrent block and motion vector predictor v₁ at the upper-right cornercontrol point of the current block are then calculated from derivedmotion vectors v₃, v₄, and v₅.

It is to be noted that this method for deriving motion vector predictorsmay be used to derive motion vector predictors of the respective controlpoints of the current block in Step Sj_1 in FIG. 29 .

[MV Derivation>DMVR]

FIG. 31A is a flow chart illustrating a relationship between the mergemode and DMVR.

Inter predictor 126 derives a motion vector of a current block accordingto the merge mode (Step Sl_1). Next, inter predictor 126 determineswhether to perform estimation of a motion vector, that is, motionestimation (Step Sl_2). Here, when determining not to perform motionestimation (No in Step S1_2), inter predictor 126 determines the motionvector derived in Step Sl_1 as the final motion vector for the currentblock (Step S1_4). In other words, in this case, the motion vector ofthe current block is determined according to the merge mode.

When determining to perform motion estimation in Step Sl_1 (Yes in StepS1_2), inter predictor 126 derives the final motion vector for thecurrent block by estimating a surrounding region of the referencepicture specified by the motion vector derived in Step Sl_1 (Step S1_3).In other words, in this case, the motion vector of the current block isdetermined according to the DMVR.

FIG. 31B is a conceptual diagram for illustrating one example of a DMVRprocess for determining an MV.

First, (for example, in merge mode) the best MVP which has been set tothe current block is determined to be an MV candidate. A reference pixelis identified from a first reference picture (L0) which is an encodedpicture in the L0 direction according to an MV candidate (L0). Likewise,a reference pixel is identified from a second reference picture (L1)which is an encoded picture in the L1 direction according to an MVcandidate (L1). A template is generated by calculating an average ofthese reference pixels.

Next, each of the surrounding regions of MV candidates of the firstreference picture (L0) and the second reference picture (L1) areestimated, and the MV which yields the smallest cost is determined to bethe final MV. It is to be noted that the cost value may be calculated,for example, using a difference value between each of the pixel valuesin the template and a corresponding one of the pixel values in theestimation region, the values of MV candidates, etc.

It is to be noted that the processes, configurations, and operationsdescribed here typically are basically common between the encoder and adecoder to be described later.

Exactly the same example processes described here do not always need tobe performed. Any process for enabling derivation of the final MV byestimation in surrounding regions of MV candidates may be used.

[Motion Compensation>BIO/OBMC]

Motion compensation involves a mode for generating a prediction image,and correcting the prediction image. The mode is, for example, BIO andOBMC to be described later.

FIG. 32 is a flow chart illustrating one example of generation of aprediction image.

Inter predictor 126 generates a prediction image (Step Sm_1), andcorrects the prediction image, for example, according to any of themodes described above (Step Sm_2).

FIG. 33 is a flow chart illustrating another example of generation of aprediction image.

Inter predictor 126 determines a motion vector of a current block (StepSn_1). Next, inter predictor 126 generates a prediction image (StepSn_2), and determines whether to perform a correction process (StepSn_3). Here, when determining to perform a correction process (Yes inStep Sn_3), inter predictor 126 generates the final prediction image bycorrecting the prediction image (Step Sn_4). When determining not toperform a correction process (No in Step Sn_3), inter predictor 126outputs the prediction image as the final prediction image withoutcorrecting the prediction image (Step Sn_5).

In addition, motion compensation involves a mode for correcting aluminance of a prediction image when generating the prediction image.The mode is, for example, LIC to be described later.

FIG. 34 is a flow chart illustrating another example of generation of aprediction image.

Inter predictor 126 derives a motion vector of a current block (StepSo_1). Next, inter predictor 126 determines whether to perform aluminance correction process (Step So_2). Here, when determining toperform a luminance correction process (Yes in Step So_2), interpredictor 126 generates the prediction image while performing aluminance correction process (Step So_3). In other words, the predictionimage is generated using LIC. When determining not to perform aluminance correction process (No in Step So_2), inter predictor 126generates a prediction image by performing normal motion compensationwithout performing a luminance correction process (Step So_4).

[Motion Compensation>OBMC]

It is to be noted that an inter prediction signal may be generated usingmotion information for a neighboring block in addition to motioninformation for the current block obtained from motion estimation. Morespecifically, the inter prediction signal may be generated in units of asub-block in the current block by performing a weighted addition of aprediction signal based on motion information obtained from motionestimation (in the reference picture) and a prediction signal based onmotion information for a neighboring block (in the current picture).Such inter prediction (motion compensation) is also referred to asoverlapped block motion compensation (OBMC).

In OBMC mode, information indicating a sub-block size for OBMC (referredto as, for example, an OBMC block size) may be signaled at the sequencelevel. Moreover, information indicating whether to apply the OBMC mode(referred to as, for example, an OBMC flag) may be signaled at the CUlevel. It is to be noted that the signaling of such information does notnecessarily need to be performed at the sequence level and CU level, andmay be performed at another level (for example, at the picture level,slice level, tile level, CTU level, or sub-block level).

Examples of the OBMC mode will be described in further detail. FIGS. 35and 36 are a flow chart and a conceptual diagram for illustrating anoutline of a prediction image correction process performed by an OBMCprocess.

First, as illustrated in FIG. 36 , a prediction image (Pred) is obtainedthrough normal motion compensation using a motion vector (MV) assignedto the processing target (current) block. In FIG. 36 , the arrow “MV”points a reference picture, and indicates what the current block of thecurrent picture refers to in order to obtain a prediction image.

Next, a prediction image (Pred_L) is obtained by applying a motionvector (MV_L) which has been already derived for the encoded blockneighboring to the left of the current block to the current block(re-using the motion vector for the current block). The motion vector(MV_L) is indicated by an arrow “MV_L” indicating a reference picturefrom a current block. A first correction of a prediction image isperformed by overlapping two prediction images Pred and Pred_L. Thisprovides an effect of blending the boundary between neighboring blocks.

Likewise, a prediction image (Pred_U) is obtained by applying a motionvector (MV_U) which has been already derived for the encoded blockneighboring above the current block to the current block (re-using themotion vector for the current block). The motion vector (MV_U) isindicated by an arrow “MV_U” indicating a reference picture from acurrent block. A second correction of a prediction image is performed byoverlapping the prediction image Pred_U to the prediction images (forexample, Pred and Pred_L) on which the first correction has beenperformed. This provides an effect of blending the boundary betweenneighboring blocks. The prediction image obtained by the secondcorrection is the one in which the boundary between the neighboringblocks has been blended (smoothed), and thus is the final predictionimage of the current block.

Although the above example is a two-path correction method using leftand upper neighboring blocks, it is to be noted that the correctionmethod may be three- or more-path correction method using also the rightneighboring block and/or the lower neighboring block.

It is to be noted that the region in which such overlapping is performedmay be only part of a region near a block boundary instead of the pixelregion of the entire block.

It is to be noted that the prediction image correction process accordingto OBMC for obtaining one prediction image Pred from one referencepicture by overlapping additional prediction image Pred_L and Pred_Uhave been described above. However, when a prediction image is correctedbased on a plurality of reference images, a similar process may beapplied to each of the plurality of reference pictures. In such a case,after corrected prediction images are obtained from the respectivereference pictures by performing OBMC image correction based on theplurality of reference pictures, the obtained corrected predictionimages are further overlapped to obtain the final prediction image.

It is to be noted that, in OBMC, the unit of a current block may be theunit of a prediction block or the unit of a sub-block obtained byfurther splitting the prediction block.

One example of a method for determining whether to apply an OBMC processis a method for using an obmc_flag which is a signal indicating whetherto apply an OBMC process. As one specific example, an encoder determineswhether the current block belongs to a region having complicated motion.The encoder sets the obmc_flag to a value of “1” when the block belongsto a region having complicated motion and applies an OBMC process whenencoding, and sets the obmc_flag to a value of “0” when the block doesnot belong to a region having complicated motion and encodes the blockwithout applying an OBMC process. The decoder switches betweenapplication and non-application of an OBMC process by decoding theobmc_flag written in the stream (for example, a compressed sequence) anddecoding the block by switching between the application andnon-application of the OBMC process in accordance with the flag value.

Inter predictor 126 generates one rectangular prediction image for arectangular current block in the above example. However, inter predictor126 may generate a plurality of prediction images each having a shapedifferent from a rectangle for the rectangular current block, and maycombine the plurality of prediction images to generate the finalrectangular prediction image. The shape different from a rectangle maybe, for example, a triangle.

FIG. 37 is a conceptual diagram for illustrating generation of twotriangular prediction images.

Inter predictor 126 generates a triangular prediction image byperforming motion compensation of a first partition having a triangularshape in a current block by using a first MV of the first partition, togenerate a triangular prediction image. Likewise, inter predictor 126generates a triangular prediction image by performing motioncompensation of a second partition having a triangular shape in acurrent block by using a second MV of the second partition, to generatea triangular prediction image. Inter predictor 126 then generates aprediction image having the same rectangular shape as the rectangularshape of the current block by combining these prediction images.

It is to be noted that, although the first partition and the secondpartition are triangles in the example illustrated in FIG. 37 , thefirst partition and the second partition may be trapezoids, or othershapes different from each other. Furthermore, although the currentblock includes two partitions in the example illustrated in FIG. 37 ,the current block may include three or more partitions.

In addition, the first partition and the second partition may overlapwith each other. In other words, the first partition and the secondpartition may include the same pixel region. In this case, a predictionimage for a current block may be generated using a prediction image inthe first partition and a prediction image in the second partition.

In addition, although an example in which a prediction image isgenerated for each of two partitions using inter prediction, aprediction image may be generated for at least one partition using intraprediction.

[Motion Compensation>BIO]

Next, a method for deriving a motion vector is described. First, a modefor deriving a motion vector based on a model assuming uniform linearmotion will be described. This mode is also referred to as abi-directional optical flow (BIO) mode.

FIG. 38 is a conceptual diagram for illustrating a model assuminguniform linear motion. In FIG. 38 , (vx, vy) indicates a velocityvector, and τ0 and τ1 indicate temporal distances between a currentpicture (Cur Pic) and two reference pictures (Ref0, Ref1). (MVx0, MVy0)indicate motion vectors corresponding to reference picture Ref0, and(MVx1, MVy1) indicate motion vectors corresponding to reference pictureRef1.

Here, under the assumption of uniform linear motion exhibited byvelocity vectors (v_(x), v_(y)), (MV_(x0), MV_(y0)) and (MV_(x1),MV_(y1)) are represented as (v_(x)τ₀, v_(y)τ₀) and (−v_(x)τ₁, −v_(y)τ₁),respectively, and the following optical flow equation (2) may beemployed.[MATH. 3]∂I ^((k)) /∂t+v _(x) ∂I ^((l)) /∂x+v _(y) ∂I ^((k)) /∂y=0.   (2)

Here, I(k) indicates a motion-compensated luma value of referencepicture k (k=0, 1). This optical flow equation shows that the sum of (i)the time derivative of the luma value, (ii) the product of thehorizontal velocity and the horizontal component of the spatial gradientof a reference image, and (iii) the product of the vertical velocity andthe vertical component of the spatial gradient of a reference image isequal to zero. A motion vector of each block obtained from, for example,a merge list may be corrected in units of a pixel, based on acombination of the optical flow equation and Hermite interpolation.

It is to be noted that a motion vector may be derived on the decoderside using a method other than deriving a motion vector based on a modelassuming uniform linear motion. For example, a motion vector may bederived in units of a sub-block based on motion vectors of neighboringblocks.

[Motion Compensation>LIC]

Next, an example of a mode in which a prediction image (prediction) isgenerated by using a local illumination compensation (LIC) process willbe described.

FIG. 39 is a conceptual diagram for illustrating one example of aprediction image generation method using a luminance correction processperformed by a LIC process.

First, an MV is derived from an encoded reference picture, and areference image corresponding to the current block is obtained.

Next, information indicating how the luma value changed between thereference picture and the current picture is extracted for the currentblock. This extraction is performed based on the luma pixel values forthe encoded left neighboring reference region (surrounding referenceregion) and the encoded upper neighboring reference region (surroundingreference region), and the luma pixel value at the correspondingposition in the reference picture specified by the derived MV. Aluminance correction parameter is calculated by using the informationindicating how the luma value changed.

The prediction image for the current block is generated by performing aluminance correction process in which the luminance correction parameteris applied to the reference image in the reference picture specified bythe MV.

It is to be noted that the shape of the surrounding reference regionillustrated in FIG. 39 is just one example; the surrounding referenceregion may have a different shape.

Moreover, although the process in which a prediction image is generatedfrom a single reference picture has been described here, cases in whicha prediction image is generated from a plurality of reference picturescan be described in the same manner. The prediction image may begenerated after performing a luminance correction process of thereference images obtained from the reference pictures in the same manneras described above.

One example of a method for determining whether to apply a LIC processis a method for using a lic_flag which is a signal indicating whether toapply the LIC process. As one specific example, the encoder determineswhether the current block belongs to a region having a luminance change.The encoder sets the lic_flag to a value of “1” when the block belongsto a region having a luminance change and applies a LIC process whenencoding, and sets the lic_flag to a value of “0” when the block doesnot belong to a region having a luminance change and encodes the currentblock without applying a LIC process. The decoder may decode thelic_flag written in the stream and decode the current block by switchingbetween application and non-application of a LIC process in accordancewith the flag value.

One example of a different method of determining whether to apply a LICprocess is a determining method in accordance with whether a LIC processwas applied to a surrounding block. In one specific example, when themerge mode is used on the current block, whether a LIC process wasapplied in the encoding of the surrounding encoded block selected uponderiving the MV in the merge mode process is determined. According tothe result, encoding is performed by switching between application andnon-application of a LIC process. It is to be noted that, also in thisexample, the same processes are applied in processes at the decoderside.

An embodiment of the luminance correction (LIC) process described withreference to FIG. 39 is described in detail below.

First, inter predictor 126 derives a motion vector for obtaining areference image corresponding to a current block to be encoded from areference picture which is an encoded picture.

Next, inter predictor 126 extracts information indicating how the lumavalue of the reference picture has been changed to the luma value of thecurrent picture, using the luma pixel value of an encoded surroundingreference region which neighbors to the left of or above the currentblock and the luma value in the corresponding position in the referencepicture specified by a motion vector, and calculates a luminancecorrection parameter. For example, it is assumed that the luma pixelvalue of a given pixel in the surrounding reference region in thecurrent picture is p0, and that the luma pixel value of the pixelcorresponding to the given pixel in the surrounding reference region inthe reference picture is p1. Inter predictor 126 calculates coefficientsA and B for optimizing A×p1+B=p0 as the luminance correction parameterfor a plurality of pixels in the surrounding reference region.

Next, inter predictor 126 performs a luminance correction process usingthe luminance correction parameter for the reference image in thereference picture specified by the motion vector, to generate aprediction image for the current block. For example, it is assumed thatthe luma pixel value in the reference image is p2, and that theluminance-corrected luma pixel value of the prediction image is p3.Inter predictor 126 generates the prediction image after being subjectedto the luminance correction process by calculating A×p2+B=p3 for each ofthe pixels in the reference image.

It is to be noted that the shape of the surrounding reference regionillustrated in FIG. 39 is one example; a different shape other than theshape of the surrounding reference region may be used. In addition, partof the surrounding reference region illustrated in FIG. 39 may be used.For example, a region having a determined number of pixels extractedfrom each of an upper neighboring pixel and a left neighboring pixel maybe used as a surrounding reference region. The determined number ofpixels may be predetermined.

In addition, the surrounding reference region is not limited to a regionwhich neighbors the current block, and may be a region which does notneighbor the current block. In the example illustrated in FIG. 39 , thesurrounding reference region in the reference picture is a regionspecified by a motion vector in a current picture, from a surroundingreference region in the current picture. However, a region specified byanother motion vector is also possible. For example, the other motionvector may be a motion vector in a surrounding reference region in thecurrent picture.

Although operations performed by encoder 100 have been described here,it is to be noted that decoder 200 typically performs similaroperations.

It is to be noted that the LIC process may be applied not only to theluma but also to chroma. At this time, a correction parameter may bederived individually for each of Y, Cb, and Cr, or a common correctionparameter may be used for any of Y, Cb, and Cr.

In addition, the LIC process may be applied in units of a sub-block. Forexample, a correction parameter may be derived using a surroundingreference region in a current sub-block and a surrounding referenceregion in a reference sub-block in a reference picture specified by anMV of the current sub-block.

[Prediction Controller]

Inter predictor 128 selects one of an intra prediction signal (a signaloutput from intra predictor 124) and an inter prediction signal (asignal output from inter predictor 126), and outputs the selected signalto subtractor 104 and adder 116 as a prediction signal.

As illustrated in FIG. 1 , in various kinds of encoder examples,prediction controller 128 may output a prediction parameter which isinput to entropy encoder 110. Entropy encoder 110 may generate anencoded bitstream (or a sequence), based on the prediction parameterwhich is input from prediction controller 128 and quantized coefficientswhich are input from quantizer 108. The prediction parameter may be usedin a decoder. The decoder may receive and decode the encoded bitstream,and perform the same processes as the prediction processes performed byintra predictor 124, inter predictor 126, and prediction controller 128.The prediction parameter may include (i) a selection prediction signal(for example, a motion vector, a prediction type, or a prediction modeused by intra predictor 124 or inter predictor 126), or (ii) an optionalindex, a flag, or a value which is based on a prediction processperformed in each of intra predictor 124, inter predictor 126, andprediction controller 128, or which indicates the prediction process.

[Mounting Example of Encoder]

FIG. 40 is a block diagram illustrating a mounting example of encoder100. Encoder 100 includes processor a1 and memory a2. For example, theplurality of constituent elements of encoder 100 illustrated in FIG. 1are mounted on processor a1 and memory a2 illustrated in FIG. 40 .

Processor a1 is circuitry which performs information processing and isaccessible to memory a2. For example, processor a1 is dedicated orgeneral electronic circuitry which encodes a video. Processor a1 may bea processor such as a CPU. In addition, processor a1 may be an aggregateof a plurality of electronic circuits. In addition, for example,processor a1 may take the roles of two or more constituent elements outof the plurality of constituent elements of encoder 100 illustrated inFIG. 1 , etc.

Memory a2 is dedicated or general memory for storing information that isused by processor a1 to encode a video. Memory a2 may be electroniccircuitry, and may be connected to processor a1. In addition, memory a2may be included in processor a1. In addition, memory a2 may be anaggregate of a plurality of electronic circuits. In addition, memory a2may be a magnetic disc, an optical disc, or the like, or may berepresented as a storage, a recording medium, or the like. In addition,memory a2 may be non-volatile memory, or volatile memory.

For example, memory a2 may store a video to be encoded or a bitstreamcorresponding to an encoded video. In addition, memory a2 may store aprogram for causing processor a1 to encode a video.

In addition, for example, memory a2 may take the roles of two or moreconstituent elements for storing information out of the plurality ofconstituent elements of encoder 100 illustrated in FIG. 1 , etc. Forexample, memory a2 may take the roles of block memory 118 and framememory 122 illustrated in FIG. 1 . More specifically, memory a2 maystore a reconstructed block, a reconstructed picture, etc.

It is to be noted that, in encoder 100, all of the plurality ofconstituent elements indicated in FIG. 1 , etc., may not be implemented,and all the processes described above may not be performed. Part of theconstituent elements indicated in FIG. 1 , etc., may be included inanother device, or part of the processes described above may beperformed by another device.

[Decoder]

Next, a decoder capable of decoding an encoded signal (encodedbitstream) output, for example, from encoder 100 described above will bedescribed. FIG. 41 is a block diagram illustrating a functionalconfiguration of decoder 200 according to an embodiment. Decoder 200 isa video decoder which decodes a video in units of a block.

As illustrated in FIG. 41 , decoder 200 includes entropy decoder 202,inverse quantizer 204, inverse transformer 206, adder 208, block memory210, loop filter 212, frame memory 214, intra predictor 216, interpredictor 218, and prediction controller 220.

Decoder 200 is implemented as, for example, a generic processor andmemory. In this case, when a software program stored in the memory isexecuted by the processor, the processor functions as entropy decoder202, inverse quantizer 204, inverse transformer 206, adder 208, loopfilter 212, intra predictor 216, inter predictor 218, and predictioncontroller 220. Alternatively, decoder 200 may be implemented as one ormore dedicated electronic circuits corresponding to entropy decoder 202,inverse quantizer 204, inverse transformer 206, adder 208, loop filter212, intra predictor 216, inter predictor 218, and prediction controller220.

Hereinafter, an overall flow of processes performed by decoder 200 isdescribed, and then each of constituent elements included in decoder 200will be described.

[Overall Flow of Decoding Process]

FIG. 42 is a flow chart illustrating one example of an overall decodingprocess performed by decoder 200.

First, entropy decoder 202 of decoder 200 identifies a splitting patternof a block having a fixed size (for example, 128×128 pixels) (StepSp_1). This splitting pattern is a splitting pattern selected by encoder100. Decoder 200 then performs processes of Step Sp_2 to Sp_6 for eachof a plurality of blocks of the splitting pattern.

In other words, entropy decoder 202 decodes (specifically,entropy-decodes) encoded quantized coefficients and a predictionparameter of a current block to be decoded (also referred to as acurrent block) (Step Sp_2).

Next, inverse quantizer 204 performs inverse quantization of theplurality of quantized coefficients and inverse transformer 206 performsinverse transform of the result, to restore a plurality of predictionresiduals (that is, a difference block) (Step Sp_3).

Next, the prediction processor including all or part of intra predictor216, inter predictor 218, and prediction controller 220 generates aprediction signal (also referred to as a prediction block) of thecurrent block (Step Sp_4).

Next, adder 208 adds the prediction block to the difference block togenerate a reconstructed image (also referred to as a decoded imageblock) of the current block (Step Sp_5).

When the reconstructed image is generated, loop filter 212 performsfiltering of the reconstructed image (Step Sp_6).

Decoder 200 then determines whether decoding of the entire picture hasbeen finished (Step Sp_7). When determining that the decoding has notyet been finished (No in Step Sp_7), decoder 200 repeatedly executes theprocesses starting with Step Sp_1.

As illustrated, the processes of Steps Sp_1 to Sp_7 are performedsequentially by decoder 200. Alternatively, two or more of the processesmay be performed in parallel, the processing order of the two or more ofthe processes may be modified, etc.

[Entropy Decoder]

Entropy decoder 202 entropy decodes an encoded bitstream. Morespecifically, for example, entropy decoder 202 arithmetic decodes anencoded bitstream into a binary signal. Entropy decoder 202 thendebinarizes the binary signal. With this, entropy decoder 202 outputsquantized coefficients of each block to inverse quantizer 204. Entropydecoder 202 may output a prediction parameter included in an encodedbitstream (see FIG. 1 ) to intra predictor 216, inter predictor 218, andprediction controller 220. Intra predictor 216, inter predictor 218, andprediction controller 220 in an embodiment are capable of executing thesame prediction processes as those performed by intra predictor 124,inter predictor 126, and prediction controller 128 at the encoder side.

[Inverse Quantizer]

Inverse quantizer 204 inverse quantizes quantized coefficients of ablock to be decoded (hereinafter referred to as a current block) whichare inputs from entropy decoder 202. More specifically, inversequantizer 204 inverse quantizes quantized coefficients of the currentblock, based on quantization parameters corresponding to the quantizedcoefficients. Inverse quantizer 204 then outputs the inverse quantizedtransform coefficients of the current block to inverse transformer 206.

[Inverse Transformer]

Inverse transformer 206 restores prediction errors by inversetransforming the transform coefficients which are inputs from inversequantizer 204.

For example, when information parsed from an encoded bitstream indicatesthat EMT or AMT is to be applied (for example, when an AMT flag istrue), inverse transformer 206 inverse transforms the transformcoefficients of the current block based on information indicating theparsed transform type.

Moreover, for example, when information parsed from an encoded bitstreamindicates that NSST is to be applied, inverse transformer 206 applies asecondary inverse transform to the transform coefficients.

[Adder]

Adder 208 reconstructs the current block by adding prediction errorswhich are inputs from inverse transformer 206 and prediction sampleswhich are inputs from prediction controller 220. Adder 208 then outputsthe reconstructed block to block memory 210 and loop filter 212.

[Block Memory]

Block memory 210 is storage for storing blocks in a picture to bedecoded (hereinafter referred to as a current picture) and to bereferred to in intra prediction. More specifically, block memory 210stores reconstructed blocks output from adder 208.

[Loop Filter]

Loop filter 212 applies a loop filter to blocks reconstructed by adder208, and outputs the filtered reconstructed blocks to frame memory 214,display device, etc.

When information indicating ON or OFF of an ALF parsed from an encodedbitstream indicates that an ALF is ON, one filter from among a pluralityof filters is selected based on direction and activity of localgradients, and the selected filter is applied to the reconstructedblock.

[Frame Memory]

Frame memory 214 is, for example, storage for storing reference picturesfor use in inter prediction, and is also referred to as a frame buffer.More specifically, frame memory 214 stores a reconstructed blockfiltered by loop filter 212.

[Prediction Processor (Intra Predictor, Inter Predictor, PredictionController)]

FIG. 43 is a flow chart illustrating one example of a process performedby a prediction processor of decoder 200. It is to be noted that theprediction processor includes all or part of the following constituentelements: intra predictor 216; inter predictor 218; and predictioncontroller 220.

The prediction processor generates a prediction image of a current block(Step Sq_1). This prediction image is also referred to as a predictionsignal or a prediction block. It is to be noted that the predictionsignal is, for example, an intra prediction signal or an interprediction signal. Specifically, the prediction processor generates theprediction image of the current block using a reconstructed image whichhas been already obtained through generation of a prediction block,generation of a difference block, generation of a coefficient block,restoring of a difference block, and generation of a decoded imageblock.

The reconstructed image may be, for example, an image in a referencepicture, or an image of a decoded block in a current picture which isthe picture including the current block. The decoded block in thecurrent picture is, for example, a neighboring block of the currentblock.

FIG. 44 is a flow chart illustrating another example of a processperformed by the prediction processor of decoder 200.

The prediction processor determines either a method or a mode forgenerating a prediction image (Step Sr_1). For example, the method ormode may be determined based on, for example, a prediction parameter,etc.

When determining a first method as a mode for generating a predictionimage, the prediction processor generates a prediction image accordingto the first method (Step Sr_2 a). When determining a second method as amode for generating a prediction image, the prediction processorgenerates a prediction image according to the second method (Step Sr_2b). When determining a third method as a mode for generating aprediction image, the prediction processor generates a prediction imageaccording to the third method (Step Sr_2 c).

The first method, the second method, and the third method may bemutually different methods for generating a prediction image. Each ofthe first to third methods may be an inter prediction method, an intraprediction method, or another prediction method. The above-describedreconstructed image may be used in these prediction methods.

[Intra Predictor]

Intra predictor 216 generates a prediction signal (intra predictionsignal) by performing intra prediction by referring to a block or blocksin the current picture stored in block memory 210, based on the intraprediction mode parsed from the encoded bitstream. More specifically,intra predictor 216 generates an intra prediction signal by performingintra prediction by referring to samples (for example, luma and/orchroma values) of a block or blocks neighboring the current block, andthen outputs the intra prediction signal to prediction controller 220.

It is to be noted that when an intra prediction mode in which a lumablock is referred to in intra prediction of a chroma block is selected,intra predictor 216 may predict the chroma component of the currentblock based on the luma component of the current block.

Moreover, when information parsed from an encoded bitstream indicatesthat PDPC is to be applied, intra predictor 216 corrects intra-predictedpixel values based on horizontal/vertical reference pixel gradients.

[Inter Predictor]

Inter predictor 218 predicts the current block by referring to areference picture stored in frame memory 214. Inter prediction isperformed in units of a current block or a sub-block (for example, a 4×4block) in the current block. For example, inter predictor 218 generatesan inter prediction signal of the current block or the sub-block byperforming motion compensation by using motion information (for example,a motion vector) parsed from an encoded bitstream (for example, aprediction parameter output from entropy decoder 202), and outputs theinter prediction signal to prediction controller 220.

It is to be noted that when the information parsed from the encodedbitstream indicates that the OBMC mode is to be applied, inter predictor218 generates the inter prediction signal using motion information of aneighboring block in addition to motion information of the current blockobtained from motion estimation.

Moreover, when the information parsed from the encoded bitstreamindicates that the FRUC mode is to be applied, inter predictor 218derives motion information by performing motion estimation in accordancewith the pattern matching method (bilateral matching or templatematching) parsed from the encoded bitstream. Inter predictor 218 thenperforms motion compensation (prediction) using the derived motioninformation.

Moreover, when the BIO mode is to be applied, inter predictor 218derives a motion vector based on a model assuming uniform linear motion.Moreover, when the information parsed from the encoded bitstreamindicates that the affine motion compensation prediction mode is to beapplied, inter predictor 218 derives a motion vector of each sub-blockbased on motion vectors of neighboring blocks.

[MV Derivation>Normal Inter Mode]

When information parsed from an encoded bitstream indicates that thenormal inter mode is to be applied, inter predictor 218 derives an MVbased on the information parsed from the encoded bitstream and performsmotion compensation (prediction) using the MV.

FIG. 45 is a flow chart illustrating an example of inter prediction innormal inter mode in decoder 200.

Inter predictor 218 of decoder 200 performs motion compensation for eachblock. Inter predictor 218 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of decodedblocks temporally or spatially surrounding the current block (StepSs_1). In other words, inter predictor 218 generates an MV candidatelist.

Next, inter predictor 218 extracts N (an integer of 2 or larger) MVcandidates from the plurality of MV candidates obtained in Step Ss_1, asmotion vector predictor candidates (also referred to as MV predictorcandidates) according to a determined priority order (Step Ss_2). It isto be noted that the priority order may be determined in advance foreach of the N MV predictor candidates.

Next, inter predictor 218 decodes motion vector predictor selectioninformation from an input stream (that is, an encoded bitstream), andselects, one MV predictor candidate from the N MV predictor candidatesusing the decoded motion vector predictor selection information, as amotion vector (also referred to as an MV predictor) of the current block(Step Ss_3).

Next, inter predictor 218 decodes an MV difference from the inputstream, and derives an MV for a current block by adding a differencevalue which is the decoded MV difference and a selected motion vectorpredictor (Step Ss_4).

Lastly, inter predictor 218 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the decoded reference picture (Step Ss_5).

[Prediction Controller]

Prediction controller 220 selects either the intra prediction signal orthe inter prediction signal, and outputs the selected prediction signalto adder 208. As a whole, the configurations, functions, and processesof prediction controller 220, intra predictor 216, and inter predictor218 at the decoder side may correspond to the configurations, functions,and processes of prediction controller 128, intra predictor 124, andinter predictor 126 at the encoder side.

[Mounting Example of Decoder]

FIG. 46 is a block diagram illustrating a mounting example of decoder200. Decoder 200 includes processor b1 and memory b2. For example, theplurality of constituent elements of decoder 200 illustrated in FIG. 41are mounted on processor b1 and memory b2 illustrated in FIG. 46 .

Processor b1 is circuitry which performs information processing and isaccessible to memory b2. For example, processor b1 is dedicated orgeneral electronic circuitry which decodes a video (that is, an encodedbitstream). Processor b1 may be a processor such as a CPU. In addition,processor b1 may be an aggregate of a plurality of electronic circuits.In addition, for example, processor b1 may take the roles of two or moreconstituent elements out of the plurality of constituent elements ofdecoder 200 illustrated in FIG. 41 , etc.

Memory b2 is dedicated or general memory for storing information that isused by processor b1 to decode an encoded bitstream. Memory b2 may beelectronic circuitry, and may be connected to processor b1. In addition,memory b2 may be included in processor b1. In addition, memory b2 may bean aggregate of a plurality of electronic circuits. In addition, memoryb2 may be a magnetic disc, an optical disc, or the like, or may berepresented as a storage, a recording medium, or the like. In addition,memory b2 may be a non-volatile memory, or a volatile memory.

For example, memory b2 may store a video or a bitstream. In addition,memory b2 may store a program for causing processor b1 to decode anencoded bitstream.

In addition, for example, memory b2 may take the roles of two or moreconstituent elements for storing information out of the plurality ofconstituent elements of decoder 200 illustrated in FIG. 41 , etc.Specifically, memory b2 may take the roles of block memory 210 and framememory 214 illustrated in FIG. 41 . More specifically, memory b2 maystore a reconstructed block, a reconstructed picture, etc.

It is to be noted that, in decoder 200, all of the plurality ofconstituent elements illustrated in FIG. 41 , etc., may not beimplemented, and all the processes described above may not be performed.Part of the constituent elements indicated in FIG. 41 , etc., may beincluded in another device, or part of the processes described above maybe performed by another device.

[Definitions of Terms]

The respective terms may be defined as indicated below as examples.

A picture is an array of luma samples in monochrome format or an arrayof luma samples and two corresponding arrays of chroma samples in 4:2:0,4:2:2, and 4:4:4 color format. A picture may be either a frame or afield.

A frame is the composition of a top field and a bottom field, wheresample rows 0, 2, 4, . . . originate from the top field and sample rows1, 3, 5, . . . originate from the bottom field.

A slice is an integer number of coding tree units contained in oneindependent slice segment and all subsequent dependent slice segments(if any) that precede the next independent slice segment (if any) withinthe same access unit.

A tile is a rectangular region of coding tree blocks within a particulartile column and a particular tile row in a picture. A tile may be arectangular region of the frame that is intended to be able to bedecoded and encoded independently, although loop-filtering across tileedges may still be applied.

A block is an M×N (M-column by N-row) array of samples, or an M×N arrayof transform coefficients. A block may be a square or rectangular regionof pixels including one Luma and two Chroma matrices.

A coding tree unit (CTU) may be a coding tree block of luma samples of apicture that has three sample arrays, or two corresponding coding treeblocks of chroma samples. Alternatively, a CTU may be a coding treeblock of samples of one of a monochrome picture and a picture that iscoded using three separate color planes and syntax structures used tocode the samples. A super block may be a square block of 64×64 pixelsthat consists of either 1 or 2 mode info blocks or is recursivelypartitioned into four 32×32 blocks, which themselves can be furtherpartitioned.

(Embodiment 2)

Encoder 100 according to the present embodiment has a configurationequivalent to the configuration described in Embodiment 1. Furthermore,quantizer 108, inverse quantizer 112, and entropy encoder 110 of encoder100 according to the present embodiment have functions additional oralternative to the functions described in Embodiment 1. Likewise,decoder 200 according to the present embodiment has a configurationequivalent to the configuration described in Embodiment 1. Furthermore,inverse quantizer 204 and entropy decoder 202 of decoder 200 accordingto the present embodiment have functions additional or alternative tothe functions described in Embodiment 1.

For example, quantizer 108 according to the present embodiment performsdependent quantization (DQ), and inverse quantizers 112 and 204according to the present embodiment perform inverse quantizationcorresponding to the DQ. In addition, entropy encoder 110 according tothe present embodiment performs arithmetic encoding on a quantizedcoefficient using a flag, and entropy decoder 202 performs arithmeticdecoding on a quantized coefficient on which arithmetic encoding hasbeen performed using a flag.

The first to third aspects described below are specific aspects of theprocesses performed by encoder 100 and decoder 200 according to thepresent embodiment.

[First Aspect]

(Outline of Coefficient Encoding)

Entropy encoder 110 of encoder 100 according to the present embodimenttransforms the above-described quantized coefficient to be in a formatin which at least one flag is used (hereinafter referred to as a flagformat), and performs arithmetic encoding on the quantized coefficientin the format. It should be noted that a quantized coefficient is avalue obtained as a result of performing transformation and quantizationon a prediction residual generated by inter prediction or intraprediction. The quantized coefficient is also referred to as a residualcoefficient. The quantized coefficient is also referred to simply as acoefficient in the description below.

Entropy encoder 110 transforms a coefficient to be in a flag format inwhich at least one of: a significant_flag (hereinafter referred to as asig_flag); a parity_flag; a greater1_flag (hereinafter referred to as agt1_flag); a greater2_flag (hereinafter referred to as a gt2_flag); anda remainder is used.

The sig_flag is a flag indicating whether a coefficient is 0 or not. Forexample, the sig_flag indicates 0 when the coefficient is 0, andindicates 1 when the coefficient is not 0.

The parity_flag is a flag used when the coefficient is not 0, andindicates whether the coefficient is even or odd. In other words, theparity_flag is a flag which indicates that the first bit of acoefficient (e.g., the least significant bit) is 0 or 1. For example,the parity_flag indicates 1 when a coefficient is even, and indicates 0when a coefficient is odd. In addition, the parity_flag is used togetherwith the sig_flag, and indicates a value from 1 to 2 in combination withthe sig_flag.

The gt1_flag is a flag used when the coefficient is not 0, and indicateswhether an absolute value of the coefficient is greater than or equal to3, for example. For example, the gt1_flag indicates 1 when the absolutevalue of a coefficient is greater than or equal to 3, and indicates 0when the absolute value of a coefficient is not greater than or equal to3.

The gt2_flag is a flag used when the absolute value of a coefficient isgreater than or equal to 3 (in other words, in the case wheregt1_flag=1), and indicates whether the absolute value of the coefficientis greater than or equal to 5, for example. For example, the gt2_flagindicates 1 when the absolute value of a coefficient is greater than orequal to 5, and indicates 0 when the absolute value of a coefficient isnot greater than or equal to 5.

The remainder is a value used for a coefficient of gt2_flag=1, andindicated by (AbsLevel−5)/2, for example. It should be noted thatAbsLevel is an absolute value of a coefficient. In addition, the numberof the value after the decimal point of (AbsLevel−5)/2 may be truncated.

Accordingly, entropy decoder 202 calculates AbsLevel by“AbsLevel=sig_flag+parity_flag+2*gt1_flag+2*gt2_flag+2*remainder.”

It should be noted that the parity_flag is not used according to thestandard of H.265/HEVC. Accordingly, in entropy decoding, the AbsLevelis calculated by “AbsLevel=sig_flag+gt1_flag+gt2_flag+remainder.”

Here, the parity_flag may be used in the above-described DQ, forexample.

FIG. 47 is a diagram for explaining an outline of dependent Quantization(DQ).

Quantizer 108 of encoder 100 switches between and uses two quantizersdifferent from each other. It should be noted that these two quantizersrespectively use two quantization methods different from each other, andthus it can be said that quantizer 108 switches between and uses twoquantization methods different from each other.

The two quantizers are first quantizer Q0 and second quantizer Q1 asillustrated in FIG. 47 . First quantizer Q0 uses an equal quantizationwidth which is determined based on a quantization parameter, and secondquantizer Q1 uses at least two quantization widths different from eachother. In a specific example, as illustrated in FIG. FIG. 47 , aquantization width used for the range between a numerical value “0” anda numerical value “1” and the range between a numerical value “0” and anumerical value “-1” is half of a quantization width used outside theseranges, in second quantizer Q1. For example, inverse quantizers 112 and204 perform inverse quantization on numerical values “1,” “2,” and “3”included in a bitstream into “12,” “24,” and “36,” respectively, whenfirst quantizer Q0 is used. Meanwhile, inverse quantizers 112 and 204perform inverse quantization on numerical values “1,” “2,” and “3”included in a bitstream into “6,” “18,” and “30,” respectively, whensecond quantizer Q1 is used.

FIG. 48 and FIG. 49 are diagrams illustrating one example of statetransition of quantizer 108. More specifically, FIG. 48 is a diagramwhich visually illustrates state transition. FIG. 49 is a diagramillustrating the state transition in a two-dimensional table format, andindicates a state before transition and a state after transition that isdetermined by a quantized coefficient.

Quantizer 108 can take four states. The four states are state=0, 1, 2,and 3. In the case where state=0 or 1, quantizer 108 performsquantization using first quantizer Q0, and in the case of state=2 or 3,quantizer 108 performs quantization using second quantizer Q1.

In the initial state, the state is, for example, state=0. At this time,quantizer 108 quantizes, using first quantizer Q0, a pre-quantizationcoefficient that is the first coefficient in scan order, and therebycalculates a quantized coefficient. It should be noted that thepre-quantization coefficient is a coefficient before quantization isperformed thereon, and is the above-described transform coefficient. Asa result, quantizer 108 transitions to state=0 when the first bit ofquantized coefficient k is 0, and transitions to state=2 when the firstbit of quantized coefficient k is 1. Accordingly, quantizer 108calculates a new quantized coefficient k by quantizing apre-quantization coefficient that is the next coefficient in scan order,using a quantizer corresponding to the state after the transition. Asdescribed above, quantizer 108, every time a new quantized coefficient kis obtained, transitions a state according to whether the first bit ofthe new quantized coefficient k is 0 or 1.

It should be noted that, in DQ, although quantizer 108 uses twoquantizers, quantizer 108 may use three or more quantizers, and mayperform state transition different from the state transition illustratedin FIG. 48 and FIG. 49 .

In addition, the above-described parity flag indicates that the firstbit of quantized coefficient k is 0 or 1. Accordingly, in DQ, quantizer108 may determine a quantizer to be used for the next pre-quantizationcoefficient, according to the parity flag.

Furthermore, inverse quantizers 112 and 204 also perform statetransition using a plurality of quantizers in DQ, in the same manner asquantizer 108.

FIG. 50 is a diagram illustrating one example of binarization of aremainder.

Entropy encoder 110 encodes a remainder using Golomb-Rice coding. Inaddition, entropy encoder 110 switches the encoding method of aremainder, using a rice parameter, for example. For example, a riceparameter can take three values, such as g=0, 1, and 2. It should benoted that g is a variable indicating a rice parameter. Accordingly,entropy encoder 110 selects an encoding method according to a valueindicated by a rice parameter from among three encoding methods, andencodes a remainder using the selected encoding method. It should benoted that the encoding method may be referred to as a binarizingmethod.

In addition, entropy encoder 110 binarizes a remainder using a prefixand a suffix in Golomb-Rice coding. Rice coding is used when using theprefix, and unary coding and index Golomb code are used when using thesuffix.

For example, entropy encoder 110 binarizes a remainder using a prefixwithout using a suffix when the rice parameter is g=0, as illustrated inFIG. 50 . Meanwhile, entropy encoder 110 binarizes a remainder using aprefix and a suffix when the rice parameter is g=1 or 2.

In addition, in the example illustrated in FIG. 50 , as the value of aremainder is smaller, the encoding method in the case of g=0 canbinarize the remainder into a smaller number of bits than the otherencoding methods. On the other hand, as the value of a remainder isgreater, the encoding method in the case of g=2 can binarize theremainder into a smaller number of bits than the other encoding methods.In addition, when the value of a remainder in not small or great, theencoding method in the case of g=1 can binarize the remainder into asmaller number of bits than the other encoding methods.

It should be noted that, in the example illustrated in FIG. 50 , therice parameter c take three values. However, the rice parameter may takefour or more values. In this case, entropy encoder 110 selects anencoding method according to the rice parameter from among four or moreencoding methods (i.e., binarizing methods), and encodes a remainderusing the selected encoding method.

It should be noted that entropy decoder 202 may switch the decodingmethod (specifically, a debinarizing method) according to a riceparameter, in the same manner as entropy encoder 110.

FIG. 51 is a diagram for describing a method of determining a riceparameter. More specifically, FIG. 51 indicates a current coefficient tobe encoded (the black square indicated in FIG. 51 ) and fivecoefficients located around the current coefficient (the hatched squaresindicated in FIG. 51 ) among coefficients included in a block (e.g., atransform unit).

For example, when encoding the current coefficient, entropy encoder 110determines a rice parameter for the current coefficient, using the fivecoefficients (hereinafter referred to as surrounding coefficients)located around the current coefficient. The five surroundingcoefficients include two coefficients horizontally arrayed to the rightof the current coefficient, two coefficients vertically arrayed underthe current coefficient, and one coefficient located to the lower rightof the current coefficient. It should be noted that these fivesurrounding coefficients are encoded prior to encoding the currentcoefficient in encoding, and these five surrounding coefficients aredecoded prior to decoding a current coefficient to be decoded (the samecoefficient as the current coefficient to be encoded) in decoding.

Entropy encoder 110 calculates a sum_minus1 bysum_minus1=sum_abs−num_sig, for determining a rice parameter. Thesum_abs is an absolute value of a sum of the five surroundingcoefficients. The num_sig is the number of coefficients which are not 0among the five surrounding coefficients. It should be noted that, themethod of deriving a sum_minus1 described above is merely an example,and thus other methods may be used in deriving a sum_minus1. Forexample, the sum_minus1 may be derived by sum_minus1=sum_abs withoutusing the num_sig, or another offset value may be used instead of thenum_sig to derive the sum_minus1 by sum_minus1=sum_abs−offset value.

Through the calculation, when sum_minus1<12, entropy encoder 110determines a rice parameter to be g=0. In addition, when12≤sum_minus1<25, entropy encoder 110 determines a rice parameter to beg=1. In addition, when 25≤sum_minus1, entropy encoder 110 determines arice parameter to be g=2. Entropy encoder 110 selects an encoding methodcorresponding to the rice parameter determined in the above-describedmanner, and performs Golomb-Rice coding on a remainder, i.e.,(AbsLevel−5)/2, using the selected encoding method.

FIG. 52 is a diagram which indicates a code length of a binary signalobtained as a result of Golomb-Rice coding performed on a remainder.

For example, the code length of the binary signal obtained as a resultof Golomb-Rice coding performed on a remainder=0 is: 1 when the riceparameter is g=0; 2 when the rice parameter is g=1; and 3 when the riceparameter is g=2. In addition, the code length of the binary signalobtained as a result of Golomb-Rice coding performed on a remainder=1is: 2 when the rice parameter is g=0; 2 when the rice parameter is g=1;and 3 when the rice parameter is g=2. In addition, the code length ofthe binary signal obtained as a result of Golomb-Rice coding performedon a remainder=6 is: 7 when the rice parameter is g=0; 5 when the riceparameter is g=1; and 4 when the rice parameter is g=2.

Here, when sum_minus1<12, the above-described five surroundingcoefficients are considered to each have a value of an average ofapproximately less than or equal to 3 to 4. As a result, there is apossibility that the current coefficient is close to and greater thanthe five surrounding coefficients, and thus the current coefficient ispredicted to be 5 or 6. Accordingly, since a gt1_flag and a gt2_flag areused in the flag format of the current coefficient, a remainder of thecoefficient is predicted to be a remainder=0. For example, in theexample illustrated in FIG. 52 , in the case where remainder=0, entropyencoder 110 selects g=0 as a rice parameter, in order to make the codelength of the binary signal shortest.

In addition, when 12≤sum_minus1<25, the above-described five surroundingcoefficients are considered to each have a value of an average ofapproximately 3 to 5. As a result, there is a possibility that thecurrent coefficient is close to and greater than the five surroundingcoefficients, and thus the current coefficient is predicted to be 7 or8. Accordingly, since a gt1_flag and a gt2_flag are used in the flagformat of the current coefficient, a remainder of the coefficient ispredicted to be a remainder=1. For example, in the example illustratedin FIG. 52 , in the case where a remainder=1, entropy encoder 110selects g=1 as a rice parameter, in order to make the code length of thebinary signal shortest.

In addition, when 25≤sum_minus1, the above-described five surroundingcoefficients are considered to each have a value approximately greaterthan or equal to approximately 7. As a result, there is a possibilitythat the current coefficient is close to and greater than the fivesurrounding coefficients, and thus the current coefficient is predictedto be greater than or equal to 9. Accordingly, since a gt1_flag and agt2_flag are used in the flag format of the current coefficient, aremainder of the coefficient is predicted to be a remainder≥2. Forexample, in the example illustrated in FIG. 52 , in the case where aremainder≥2, entropy encoder 110 selects g=2 as a rice parameter, inorder to make the code length of the binary signal shortest.

It should be noted that entropy decoder 202 is also capable ofdetermining a rice parameter in the same manner as entropy encoder 110.

(First Example of First Aspect)

FIG. 53 is a flowchart illustrating overall processing operations ofentropy encoder 110 according to a first example of the first aspect. Itshould be noted that the flowchart of FIG. 53 indicates the processingoperations of entropy encoder 110 when, for example, the above-describedDQ is used.

Entropy encoder 110 repeats the processes of Step S110 to S140 for eachof the sub-blocks such that each of the coefficients in the sub-block isencoded. A sub-block is a block including 4×4 pixels obtained by furthersplitting the above-described transform unit, for example.

Specifically, first, entropy encoder 110 encodes, for each of thecoefficients in a sub-block, a sig_flag of the coefficient, and encodesa parity_flag of the coefficient when the sig_flag is 1. In addition,entropy encoder 110, when the sig_flag is 1, encodes the gt1_flag of thecoefficient based on determination of whether the AbsLevel of thecoefficient is greater than or equal to 3 (Step S110).

Next, entropy encoder 110, for each of the coefficients in thesub-block, when the coefficient is greater than or equal to 3, encodesgt2_flag of the coefficient based on determination of whether theAbsLevel of the coefficient is greater than or equal to 5 (Step S120).

Next, entropy encoder 110, for each of the coefficients in thesub-block, encodes remainder=(AbsLevel−5)/2 of the coefficient based ondetermination of whether the AbsLevel of the coefficient is greater thanor equal to 5 (Step S130).

Then, entropy encoder 110, for each of the coefficients in thesub-block, encodes a sign (plus or minus) of the coefficient when thecoefficient is not 0 (Step S140). It should be noted that the sign maybe encoded as sign_flag.

Entropy encoder 110, subsequent to performing the processes of StepsS110 to S140 on the sub-block, performs the processes of Steps S110 toS140 on other sub-blocks as well.

FIG. 54 is a flowchart illustrating one example of the detailedprocessing operation of Step S110 illustrated in FIG. 53 .

Entropy encoder 110 repeats the processes of Step S111 to S117 for eachof the coefficients in the sub-block.

First, entropy encoder 110 determines whether the AbsLevel of thecurrent coefficient is AbsLevel≠0 (Step S111). Here, when determiningthat the AbsLevel of the current coefficient is not AbsLevel≠0 (No inStep S111), entropy encoder 110 encodes a sig_flag=0 for the coefficient(Step S112 b). On the other hand, when determining that the AbsLevel ofthe current coefficient is AbsLevel≠0 (Yes in Step S111), entropyencoder 110 encodes a sig_flag=1 for the coefficient (Step S112 a).

Next, entropy encoder 110 determines whether the first bit (the leastsignificant bit) of the AbsLevel of the current coefficient is 1 (StepS113). Here, entropy encoder 110, when determining that the first bit is1 (Yes in Step S113), encodes a parity_flag=0 for the coefficient (StepS114 a). On the other hand, when determining that the first bit is not 1(No in Step S113), entropy encoder 110 encodes a parity_flag=1 for thecoefficient (Step S114 b).

Next, entropy encoder 110 determines whether the AbsLevel of the currentcoefficient is greater than or equal to 3 (Step S115). Here, whendetermining that the AbsLevel is greater than or equal to 3 (Yes in StepS115), entropy encoder 110 encodes a gt1_flag=1 for the coefficient(Step S116 a). On the other hand, when determining that the AbsLevel isnot greater than or equal to 3 (No in Step S115), entropy encoder 110encodes a gt1_flag=0 for the coefficient (Step S116 b).

Then, entropy encoder 110 causes quantizer 108 and inverse quantizer 112to update the state of DQ according to the current coefficient, i.e.,the parity_flag (Step S117).

Entropy encoder 110, subsequent to performing the processes of StepsS111 to S117 on a coefficient included a sub-block, also performs theprocesses of Steps S111 to S117 in the same manner on the nextcoefficient included the sub-block. In this manner, for each of thecoefficients included in the sub-block, at least one flag according tothe coefficient among the sig_flag, the parity_flag, and the gt1_flag isencoded.

FIG. 55 is a flowchart illustrating one example of the detailedprocessing operation of Step S120 illustrated in FIG. 53 .

Entropy encoder 110 repeats the processes of Step S121 to S123 b foreach of the coefficients in the sub-block.

First, entropy encoder 110 determines whether the AbsLevel of thecurrent coefficient is greater than or equal to 3 (Step S121). Here,when determining that the AbsLevel of the current coefficient is notgreater than or equal to 3 (No in Step S121), entropy encoder 110 doesnot encode a gt2_flag for the coefficient. On the other hand, whendetermining that the AbsLevel of the current coefficient is greater thanor equal to 3 (Yes in Step S121), entropy encoder 110 further determineswhether the AbsLevel is greater than or equal to 5 (Step S122). Here,when determining that the AbsLevel is greater than or equal to 5 (Yes inStep S122), entropy encoder 110 encodes a gt2_flag=1 for the coefficient(Step S123 a). On the other hand, when determining that the AbsLevel isnot greater than or equal to 5 (No in Step S122), entropy encoder 110encodes a gt2_flag=0 for the coefficient (Step S123 b).

Entropy encoder 110, subsequent to performing the processes of StepsS121 to S123 b on a coefficient included a sub-block, also performs theprocesses of Steps S121 to S123 b in the same manner on the nextcoefficient included the sub-block. In this manner, the gt2_flag isencoded as necessary for each of the coefficients included in thesub-block.

FIG. 56 is a flowchart illustrating one example of the detailedprocessing operation of Step S130 illustrated in FIG. 53 .

Entropy encoder 110 repeats the processes of Step S131 to S132 for eachof the coefficients in the sub-block.

First, entropy encoder 110 determines whether the AbsLevel of thecurrent coefficient is greater than or equal to 5 (Step S131). Here,when determining that the AbsLevel of the current coefficient is notgreater than or equal to 5 (No in Step S131), entropy encoder 110 doesnot encode a remainder for the coefficient. On the other hand, whendetermining that the AbsLevel is greater than or equal to 5 (Yes in StepS131), entropy encoder 110 encodes a remainder for the coefficient (StepS132). Accordingly, entropy encoder 110 encodes (AbsLevel−5)/2 (StepS132).

Entropy encoder 110, subsequent to performing the processes of StepsS131 to S132 on a coefficient included a sub-block, also performs theprocesses of Steps S131 to S132 in the same manner on the nextcoefficient included the sub-block. In this manner, the remainder isencoded as necessary for each of the coefficients included in thesub-block.

FIG. 57 is a diagram illustrating syntax related to entropy encodingaccording to the first example of the first aspect. More specifically,FIG. 57 illustrates a syntax structure of a stream generated by theprocesses indicated in the flowcharts illustrated in FIG. 53 to FIG. 56.

Entropy encoder 110 encodes, for each of a plurality of sub-blocks, eachof the coefficients included in the sub-block, according to the syntaxillustrated in FIG. 57 . It should be noted that sig_flag[n] andparity_flag[n] in FIG. 57 are a sig_flag and a parity_flag of the nthcoefficient included in a sub-block. In addition, abs_gt1_flag[n] andabs_gt2_flag[n] in FIG. 57 are a gt1_flag and a gt2_flag of the nthcoefficient included in a sub-block. In addition, abs_remainder[n] andsign_flag[n] in FIG. 57 are a remainder and a sign_flag of the nthcoefficient included in a sub-block.

FIG. 58 is a diagram illustrating a specific example of a sub-blockincluding 4×4 coefficients. FIG. 59 is a diagram illustrating a specificexample indicating each of the coefficients in the sub-block illustratedin FIG. 58 , in the flag format according to the first example of thefirst aspect. It should be noted that the coefficients are arrayed fromleft to right in scan order in FIG. 59 .

Entropy encoder 110 scans the sub-block illustrated in FIG. 58 . Inother words, entropy encoder 110 obtains each of the coefficients in thesub-block in predetermined order (i.e., scan order). For example,entropy encoder 110 obtains each of the coefficients in order in adiagonal direction from a coefficient at the bottom right to acoefficient at the top left in a sub-block. In the example illustratedin FIG. 58 , entropy encoder 110 obtains each of the coefficients inorder of 1, 1, 0, 2, 3, 4, 7, 5, 4, 5, 3, 6, 10, 8, 10, and 20, asillustrated in FIG. 58 . Then, entropy encoder 110 transforms, into aflag format, each of the coefficients in obtaining order of thecoefficients.

More specifically, since the AbsLevel is “1” when a coefficient is “1,”entropy encoder 110 encodes the sig_flag=1, the parity_flag=0, and thegt1_flag=0 for the coefficient.

When a coefficient is “0,” entropy encoder 110 encodes the sig_flag=0for the coefficient. In addition, since the AbsLevel is “4” when acoefficient is “4,” entropy encoder 110 encodes the sig_flag=1, theparity_flag=1, the gt1_flag=1, and the gt2_flag=0 for the coefficient.In addition, since the AbsLevel is “7” when a coefficient is “7,”entropy encoder 110 encodes the sig_flag=1, the parity_flag=0, thegt1_flag=1, the gt2_flag=1, and the remainder=1 for the coefficient.

In addition, entropy encoder 110 performs arithmetic encoding on thesesig_flag, parity_flag, gt1_flag, gt2_flag, and remainder. For thearithmetic encoding, for example, context-based adaptive binaryarithmetic coding (CABAC) is used. In addition, an adaptive variablesymbol occurrence probability may be used for the sig_flag, theparity_flag, the gt1_flag, the gt1_flag, and the gt2_flag, and a fixedsymbol occurrence probability may be used for the remainder. Morespecifically, entropy encoder 110 performs arithmetic encoding on asig_flag, a parity_flag, a gt1_flag, and a gt2_flag, while updating asymbol occurrence probability by the CABAC. Meanwhile, as to aremainder, entropy encoder 110 determines the above-described riceparameter for the remainder, and binarizes the remainder using abinarizing method according to the rice parameter. Then, entropy encoder110 performs arithmetic encoding on the binarized remainder, using afixed symbol occurrence probability, by the bypass processing of theCABAC.

In addition, entropy decoder 202 according to the first example of thefirst aspect sequentially decodes the flags and remainder of each of theencoded coefficients including the syntax illustrated in FIG. 57 . Then,entropy decoder 202 decodes, for each of the encoded coefficients, theencoded coefficient, by calculating the AbsLevel as described above,using the decoded flags and remainder, etc.

(Advantageous Effects of First Example of First Aspect)

With the first example of the first aspect as described above, it ispossible to reduce a coding amount of the remainder, by using each ofthe flags such as the gt1_flag and the gt2_flag in encodingcoefficients.

It should be noted that, in a coding unit or a transform unit, ingeneral, a sub-block has more coefficients which are not 0 as thesub-block is located closer to a low frequency side (i.e., upper leftside). In the example illustrated in FIG. 59 , a gt1_flag, a gt2_flag,etc., are used for a large number of coefficients included in asub-block. In addition, when a sub-block includes a large number ofcoefficients having values greater than or equal to 3, there is apossibility that a coding amount of the sub-block increases due to thegt1_flag and the gt2_flag.

In addition, when arithmetic encoding is performed on each flag while asymbol occurrence probability is updated by the CABAC, a processing loadis higher than when arithmetic encoding is performed by the bypassprocessing. Accordingly, when arithmetic encoding is performed on eachflag while a symbol occurrence probability is updated by the CABAC, aprocessing load increases as the number of the flags is greater. Thus,the number of these flags may be limited.

(Second Example of First Aspect)

FIG. 60 is a flowchart illustrating overall processing operations ofentropy encoder 110 according to a second example of the first aspect.

In the second example of the first aspect, unlike the first example, atotal number of flags “gt1_flag” and a total number of flags “gt2_flag”are respectively limited. For example, a total number of flags“gt1_flag” is limited up to n_1, and a total number of flags “gt2_flag”is limited up to n_2. For example, n_1 is an integer which satisfies1≤n_1≤16, and n_2 is an integer which satisfies 1≤n_2≤16.

For example, as illustrated in FIG. 60 , entropy encoder 110 repeats theprocesses of Step S210 to S230 and S140 for each of the sub-blocks suchthat each of the coefficients in the sub-block is encoded.

Specifically, first, entropy encoder 110 encodes, for each of thecoefficients in a sub-block, a sig_flag of the coefficient, and encodesa parity_flag of the coefficient when the sig_flag is 1. In addition,entropy encoder 110, when the coefficient is a coefficient which is not0 and is at or before the n_1th position, encodes a gt1_flag of thecoefficient based on determination of whether the AbsLevel of thecoefficient is greater than or equal to 3 (Step S210). It should benoted that the coefficient which is not 0 and is at or before the n_1thposition is the n_1th coefficient or a coefficient located before then_1th coefficient in scan order, among the coefficients which are not 0and are included in a sub-block.

Next, entropy encoder 110, for each of the coefficients in thesub-block, when the coefficient is a coefficient which has the AbsLevelgreater than or equal to 3 and is at or before the n_2th position,encodes a gt2_flag of the coefficient based on determination of whetherthe AbsLevel of the coefficient is greater than or equal to 5 (StepS220). It should be noted that the coefficient which has the AbsLevelgreater than or equal to 3 and is at or before the n_2th position is then_2th coefficient or a coefficient located before the n_2th coefficientin scan order, among the coefficients which have the AbsLevel greaterthan or equal to 3 and are included in a sub-block.

Next, entropy encoder 110, for each of the coefficients in thesub-block, when the AbsLevel of the coefficient is greater than or equalto a baseLevel, encodes remainder=(AbsLevel−baseLevel)/2 (Step S230).The baseLevel is a value which varies according to the number of use ofeach of the gt1_flag and the gt2_flag. For example, the initial value ofthe baseLevel is 5. In addition, the initial value is updated from 5 to3 when n_2 number of the flags “gt2_flag” are used, and then is updatedfrom 3 to 1 when n_1 (e.g., n_1>n_2) number of the flags “gt1_flag” areused.

Then, entropy encoder 110, for each of the coefficients in thesub-block, encodes a sign (plus or minus) of the coefficient when thecoefficient is not 0 (Step S140).

Entropy encoder 110, subsequent to performing the processes of StepsS210 to S230 and S140 on the sub-block, performs the processes of StepsS210 to S230 and S140 in the same manner on the other sub-blocks

FIG. 61 is a flowchart illustrating one example of the detailedprocessing operation of Step S210 illustrated in FIG. 60 . It should benoted that the flowchart illustrated in FIG. 61 includes Steps S111 toS117 of the flowchart illustrated in FIG. 54 , and further includes StepS211.

In other words, entropy encoder 110 repeats the processes of Step S111to S117, and S211 for each of the coefficients in the sub-block.

More specifically, entropy encoder 110 performs the processes of StepS111 to 114 b in the same manner as in the first example describedabove. Subsequently, entropy encoder 110 determines whether currentcoefficient a is a coefficient which is not 0 and is at or before then_1th position (Step S211). Here, when it is determined that currentcoefficient a is the coefficient which is not 0 and is at or before then_1th position (Yes in Step S211), entropy encoder 110 performs theprocesses of Steps S115 to S117 in the same manner as in the firstexample described above. On the other hand, when it is determined thatcurrent coefficient a is not the coefficient which is not 0 and is at orbefore the n_1th position (No in Step S211), entropy encoder 110performs the processes of Step S117 without performing the processed ofSteps S115 to S116 b. In other words, in the first example, entropyencoder 110 uses the gt1_flag for all of the coefficients which are not0 in the sub-block. However, in the second example, in the case wherethe gt1_flag has been used n_1 times, entropy encoder 110, in encoding acoefficient which is not 0, does not use the gt1_flag for thecoefficient.

FIG. 62 is a flowchart illustrating one example of the detailedprocessing operation of Step S220 illustrated in FIG. 60 . It should benoted that the flowchart illustrated in FIG. 62 includes Steps S122 toS123 b of the flowchart illustrated in FIG. 55 , and further includesStep S221 instead of Step S121.

In other words, entropy encoder 110 repeats the processes of Step 5221and Step S122 to S123 b for each of the coefficients in the sub-block.

More specifically, entropy encoder 110 determines whether currentcoefficient a is a coefficient which satisfies AbsLevel≥3 and is at orbefore the n_2th position (Step S221). Here, when determining thatcoefficient a is not a coefficient which satisfies AbsLevel≥3 and is ator before the n_2th position (No in Step S221), entropy encoder 110 doesnot encode a gt2_flag for coefficient a. On the other hand, whendetermining that coefficient a is a coefficient which satisfiesAbsLevel≥3 and is at or before the n_2th position (Yes in Step S221),entropy encoder 110 determines whether the AbsLevel is greater than orequal to 5 (Step S122). Here, when determining that the AbsLevel isgreater than or equal to 5 (Yes in Step S122), entropy encoder 110encodes a gt2_flag=1 for the coefficient (Step S123 a). On the otherhand, when determining that the AbsLevel is not greater than or equal to5 (No in Step S122), entropy encoder 110 encodes a gt2_flag=0 for thecoefficient (Step S123 b).

Entropy encoder 110, subsequent to performing the processes of Step S221and Steps S122 to S123 b on a coefficient included a sub-block, alsoperforms the processes of Step S221 and Steps S122 to S123 b in the samemanner on the next coefficient included the sub-block. In this manner,the gt2_flag is encoded as necessary for each of the coefficientsincluded in the sub-block.

FIG. 63 is a flowchart illustrating one example of the detailedprocessing operation of Step S230 illustrated in FIG. 60 .

First, entropy encoder 110 sets the baseLevel to 5 (Step S231). Then,entropy encoder 110 repeats the processes of Step S232 to S236 for eachof the coefficients in the sub-block.

More specifically, entropy encoder 110 determines whether n_1 number ofthe flags “gt1_flag” are used for coefficients located prior to currentcoefficient a in scan order in the sub-block (Step S232). Here, when itis determined that n_1 number of the flags “gt1_flag” are used (Yes inStep S232), entropy encoder 110 updates the baseLevel to 1 (Step S233).

On the other hand, when it is determined that n_1 number of the flags“gt1_flag” are not used (No in Step S232), entropy encoder 110 furtherperforms determination regarding a total number of the flags “gt2_flag.”More specifically, entropy encoder 110 determines whether n_2 number ofthe flags “gt2_flag” are used for coefficients located prior to currentcoefficient a in scan order in the sub-block (Step S234). Here, when itis determined that n_2 number of the flags “gt2_flag” are used (Yes inStep S234), entropy encoder 110 updates the baseLevel to 3 (Step S235).

On the other hand, when it is determined that n_2 number of the flags“gt2_flag” are not used (No in Step S234), entropy encoder 110 encodesthe remainder for coefficient a (Step S236). In addition, entropyencoder 110 also encodes the remainder for coefficient a after theprocesses of Steps S233 and S235 are performed (S236). Morespecifically, entropy encoder 110 encodes (AbsLevel−baseLevel)/2. Itshould be noted that the remainder is encoded when AbsLevel≥baseLevel issatisfied. In addition, when none of the processes of Steps S233 andS235 is performed, the baseLevel is 5. In addition, the baseLevel is 1when the process of Step S233 is performed, and the baseLevel is 3 whenthe process of Step S235 is performed. It should be noted that, in theflowchart illustrated in FIGS. 63 , n_1 and n_2 may satisfy therelationship of n_1>n_2.

Entropy encoder 110, subsequent to performing the processes of StepsS232 to S236 on a coefficient included a sub-block, also performs theprocesses of Steps S232 to S236 in the same manner on the nextcoefficient included the sub-block. In this manner, a remainder isencoded as necessary for each of the coefficients included in thesub-block.

FIG. 64 is a diagram illustrating syntax related to entropy encodingaccording to the second example of the first aspect. More specifically,FIG. 64 illustrates a syntax structure of a stream generated by theprocesses indicated in the flowcharts illustrated in FIG. 60 to FIG. 63.

Entropy encoder 110 encodes, for each of a plurality of sub-blocks, eachof the coefficients included in the sub-block, according to the syntaxillustrated in FIG. 64 .

Here, the syntax illustrated in FIG. 64 further includes setting orupdating of two counters and setting or updating of the baseLevel, inaddition to the syntax illustrated in FIG. 57 . The two counters arenumNonZero and numUpper3. The numNonZero is initialized to 0, andincremented when the sig_flag[n] is 1. When the sig_flag[n] is 1 and thenumNonZero is less than or equal to n_1, the abs_gt1_flag[n] is encoded.The numUpper3 is initialize to 0. Then, when the abs_gt1_flag[n] is 1and the numUpper3 is less than or equal to n_2, the abs_gt2_flag[n] isencoded, and the numUpper3 is incremented.

In addition, in encoding of the remainder, first, each of the numNonZeroand the numUpper3 is initialized to 0, and the baseLevel is initializedto 5. Then, when the AbsLevel[n] is not 0, the numNonZero isincremented. Furthermore, when absLevel[n] is greater than or equal to3, the numUpper3 is incremented. It should be noted that the absLevel[n]is the AbsLevel of the nth coefficient. When the absLevel[n] is greaterthan or equal to the baseLevel, (AbsLevel−baseLevel)/2 of the nthcoefficient is encoded as abs remainder[n]. Then, when the numNonZero isgreater than or equal to n_1, the baseLevel is updated to 1. Moreover,when the baseLevel is 5 and the numUpper3 is greater than or equal ton_2, the baseLevel is updated to 3.

FIG. 65 is a diagram illustrating a specific example indicating each ofthe coefficients in the sub-block illustrated in FIG. 58 , in the flagformat according to the second example of the first aspect. It should benoted that the coefficients are arrayed from left to right in scan orderin FIG. 65 .

In the example illustrated in FIGS. 65 , n_1=8, and n_2=1. Accordingly,the gt2_flag is used for a coefficient which is the first in scan orderand of which AbsLevel≥3, and is not used for the other coefficientslocated after the coefficient. In addition, the gt1_flag is used for thefirst 8 coefficients in scan order each of which is not 0, and is notused for the other coefficients located thereafter. In addition,although the baseLevel is set to 5 in the initial state, the baseLevelis updated to 3 when the gt2_flag becomes unavailable, and updated to 1when the gt1_flag becomes unavailable. Then, using the baseLevel updatedas described above, the remainder is calculated by(AbsLevel−baseLevel)/2 to be encoded.

In addition, entropy decoder 202 according to the second example of thefirst aspect sequentially decodes the encoded flags and the remainder ofeach of the coefficients including the syntax illustrated in FIG. 64 .Then, entropy decoder 202 decodes, for each of the encoded coefficients,the encoded coefficient, by calculating the AbsLevel as described above,using the decoded flags and remainder, etc.

(Advantageous Effects of Second Example of First Aspect)

In the second example as described above, a total number of flags (forexample, the gt1_flag or the gt2_flag) used for the coefficients in thesub-block is limited. Accordingly, it is possible to reduce the codingamount of the flags.

More specifically, in the example illustrated in FIG. 65 , a totalnumber of the flags “gt1_flag” and a total number of the flags“gt2_flag” are limited to 8 and 1, respectively. Accordingly, after 8flags “gt1_flag” are used, the gt1_flag is not used for a coefficienteven when the coefficient is not 0. Likewise, after one flag “gt2_flag”is used, the gt2_flag is not used for a coefficient even when theAbsLevel of the coefficient is greater than or equal to 3. As a result,in the second example, it is possible to reduce each of the total numberof flags “gt1_flag” generated and the total number of flags “gt2_flag”generated compared to the first example (for example, the exampleillustrated in FIG. 59 ). Accordingly, it is possible to reduce thecoding amount of these flags. In addition, when the CABAC of variablesymbol occurrence probability is used for encoding the gt1_flag and thegt2_flag, it is possible to reduce processing load of the encoding. Inother words, the CABAC of variable symbol occurrence probabilityinvolves a higher processing load than a processing load of the bypassprocessing of the CABAC. However, in the second example, it is possibleto reduce a total number of flags applied in the CABAC of the variablesymbol occurrence probability. Accordingly, it is possible to furtherreduce the processing load than the first example. In other words, inthe second example, it is possible to reduce both of the coding amountof coefficients and the processing load in encoding coefficients.

It should be noted that, in the second example, in FIG. 65 , the maximumnumber of the flags “gt1_flag” used is n_1=8, and the maximum number ofthe flags “gt2_flag” used is n_2=1. However, the maximum number of theflags is not limited to these examples, and may be other values. Inaddition, the maximum number n_1 and the maximum number n_2 may bepredetermined fixed values, or may be set or updated as appropriate. Inother words, entropy encoder 110 may adaptively determine each of themaximum number n_1 and the maximum number n_2.

For example, in encoding each of the coefficients in the sub-block asdescribed above, a specific flag for these coefficients; that is, flagsof specific types other than the gt1_flag and the gt2_flag are encodedprior to the other flags. It should be noted that flags of specifictypes may include, for example, at least one of the sig_flag and theparity_flag. The gt1_flag for each of the coefficients is encodedsubsequent to the flags of the specific types, and the gt2_flag for eachof the coefficients is encoded subsequent to the gt1_flag. In such acase, entropy encoder 110 may determine the maximum number n_1 as avalue which depends on a total number M of the flags of the specifictypes. Alternatively, entropy encoder 110 may determine the maximumnumber n_1 as a value which depends on a total number Ma of flags eachof which indicates a specific value such as 0 or 1, among the flags ofthe specific type. In addition, entropy encoder 110 may determine themaximum number n_2 as a value which depends on a total number N of atleast one of the flags of the specific types and the “gt1_flag.”Alternatively, entropy encoder 110 may determine the maximum number n_2as a value which depends on a total number Na of flags each of whichindicates a specific value such as 0 or 1, among at least one of theflags of the specific types and flags gt1_flag. It should be noted thateach of the above-described total number of flags M, Ma, N, and Na maybe a total number of flags which have already been encoded.

It should be noted that, in the second example, the method in which thegt1_flag and the gt2_flag are not encoded when the flags have reachedthe maximum number. However, the present disclosure is not limited tothese flags. For example, even when a flag is other than the gt1_flagand the gt2_flag, whether or not to encode the flag may be switchedusing an equivalent method, as long as the flag is related to encodingof an absolute value of a coefficient and to be encoded using the CABACthat involves updating a symbol occurrence probability.

[Second Aspect]

In the second example of the first aspect described above, the number offlags “gt1_flag” used is limited to less than or equal to the maximumnumber n_1, and the number of flags “gt2_flag” used is limited to lessthan or equal to the maximum number n_2. In the second aspect, n_2=0. Inother words, the gt2_flag is not used in the second aspect.

FIG. 66 is a flowchart illustrating overall processing operations ofentropy encoder 110 according to the second aspect.

Entropy encoder 110 repeats the processes of Steps S210, S330, and S140for each of the sub-blocks such that each of the coefficients in thesub-block is encoded.

Specifically, first, entropy encoder 110 encodes, for each of thecoefficients in a sub-block, a sig_flag of the coefficient, and encodesa parity_flag of the coefficient when the sig_flag is 1. In addition,entropy encoder 110, when the coefficient is a coefficient which is not0 and is at or before the n_1th position, encodes a gt1_flag of thecoefficient based on determination of whether the AbsLevel of thecoefficient is greater than or equal to 3 (Step S210)

Next, entropy encoder 110, for each of the coefficients in thesub-block, when the AbsLevel of the coefficient is greater than or equalto a baseLevel, encodes remainder=(AbsLevel−baseLevel)/2 (Step S330). Inthe second aspect, the baseLevel is a value which varies according tothe number of the flags “gt1_flag” used. For example, the initial valueof the baseLevel is 3. In addition, the baseLevel is updated from 3 to 1when n_1 number of the flags “gt1_flag” are used.

Then, entropy encoder 110, for each of the coefficients in thesub-block, encodes a sign (plus or minus) of the coefficient when thecoefficient is not 0 (Step S140).

Entropy encoder 110, subsequent to performing the processes of StepsS210, S330, and S140 on the sub-block, performs the processes of StepsS210, S330, and S140 in the same manner on the other sub-block. Itshould be noted that the process of Step S210 is performed according tothe flowchart illustrated in FIG. 61 .

FIG. 67 is a flowchart illustrating one example of the detailedprocessing operation of Step S330 illustrated in FIG. 66 .

First, entropy encoder 110 sets the baseLevel to 3 (Step S235). Then,entropy encoder 110 repeats the processes of Steps S232, S233, and S236for each of the coefficients in the sub-block.

More specifically, entropy encoder 110 determines whether n_1 number ofthe flags “gt1_flag” are used for coefficients located prior to currentcoefficient a in scan order in the sub-block (Step S232). Here, when itis determined that n_1 number of the flags “gt1_flag” are used (Yes inStep S232), entropy encoder 110 updates the baseLevel to 1 (Step S233).

On the other hand, when it is determined that n_1 number of the flags“gt1_flag” are not used (No in Step S232), entropy encoder 110 encodesthe remainder for coefficient a (Step S236). Entropy encoder 110 alsoencodes the remainder for coefficient a after the process of Step S233was performed (Step S236). More specifically, entropy encoder 110encodes (AbsLevel−baseLevel)/2. It should be noted that the remainder isencoded when AbsLevel≥baseLevel is satisfied. In addition, the baseLevelis 3 when the process of Step S233 is not performed, and the baseLevelis 1 when the process of Step S233 is performed.

Entropy encoder 110, subsequent to performing the processes of StepsS232, S233 and S236 on a coefficient included a sub-block, also performsthe processes of Steps S232, S233 and S236 in the same manner on thenext coefficient included the sub-block. In this manner, a remainder isencoded as necessary for each of the coefficients included in thesub-block.

FIG. 68 is a diagram illustrating syntax related to entropy encodingaccording to the second aspect. More specifically, FIG. 68 illustrates asyntax structure of a stream generated by the processes indicated by theflowcharts illustrated in FIG. 61 , FIG. 66 , and FIG. 67 .

Entropy encoder 110 encodes, for each of a plurality of sub-blocks, eachof the coefficients included in the sub-block, according to the syntaxillustrated in FIG. 68 .

Here, as compared to the syntax illustrated in FIG. 64 , the syntaxillustrated in FIG. 68 does not include setting and updating of thenumUpper3 and encoding of the gt2_flag. Furthermore, in encoding of theremainder, unlike the syntax illustrated in FIG. 64 , the baseLevel isinitialized to 3.

FIG. 69 is a diagram illustrating a specific example indicating each ofthe coefficients included in the sub-block illustrated in FIG. 58 , inthe flag format according to the second aspect. It should be noted thatthe coefficients are arrayed from left to right in scan order in FIG. 69.

In the example illustrated in FIG. 69 , n_1=16. Accordingly, thegt1_flag is used for the first 16 coefficients in scan order each ofwhich is not 0, and is not used for coefficients located thereafter. Inaddition, although the baseLevel is set to 3 in the initial state, thebaseLevel is updated to 1 when the gt1_flag becomes unavailable. Then,using the baseLevel updated as described above, the remainder iscalculated by (AbsLevel−baseLevel)/2 to be encoded.

In addition, entropy decoder 202 according to the second aspectsequentially decodes the encoded flags and the remainder of each of thecoefficients including the syntax illustrated in FIG. 68 . Then, entropydecoder 202 decodes, for each of the encoded coefficients, the encodedcoefficient, by calculating AbsLevel as described above, using thedecoded flags and remainder, etc.

(Advantageous Effects of Second Aspect)

In the second aspect, the gt2_flag is not used. With this, it ispossible to reduce the coding amount of flags and reduce the processingload. In addition, in the same manner as in the second example of thefirst aspect, since the total number of the flags “gt1_flag” is limitedto less than or equal to n_1, it is possible to further reduce theprocessing load.

More specifically, in the example illustrated in FIG. 69 , the gt2_flagis not used, and the total number of the flags “gt1_flag” are limited toless than or equal to 16. Accordingly, after 16 flags “gt1_flag” areused, the gt1_flag is not used for a coefficient even when thecoefficient is not 0. In addition, in the same manner as in the secondexample of the first aspect, the total number of the flags “gt1_flag”may be limited to less than or equal to 8, or may be limited to anarbitrary number other than 16 or 8. Accordingly, in the second aspect,as compared to the second example of the first aspect (for example, theexample illustrated in FIG. 65 ), it is possible to further reduce thecoding amount of the flags. In addition, when the CABAC of variablesymbol occurrence probability is used for encoding the gt1_flag and thegt2_flag, it is possible to reduce the processing load of the encodingof the flags. In other words, the CABAC of variable symbol occurrenceprobability involves a higher processing load than a processing load ofthe bypass processing of the CABAC. However, in the second aspect, it ispossible to further reduce a total number of flags to which the CABAC ofthe variable symbol occurrence probability is applied. Accordingly, itis possible to further reduce the processing load than the secondexample of the first aspect.

[Third Aspect]

In the first aspect and the second aspect, a rice parameter isdetermined by the sum_minus1, and a remainder is encoded in the encodingmethod according to the rice parameter. More specifically, a riceparameter is determined by comparing the sum_minus1 and a threshold (forexample, 12, 25, or the like).

According to the third aspect, in the same manner as the second aspect,a total number of each of the flags “gt1_flag” and the flags “gt2_flag”is limited, and the baseLevel is updated according to the total numberof the flags used. In addition, according to the third aspect, theabove-described threshold to be compared to the sum_minus1 fordetermining the rice parameter is changed according to the baseLevel.

FIG. 70 is a flowchart illustrating overall processing operations ofentropy encoder 110 according to the third aspect. It should be notedthat the flowchart illustrated in FIG. 70 includes Steps S430 instead ofStep S230 of the flowchart illustrated in FIG. 60 .

In the third aspect, as with the second example of the first aspect, atotal number of each of the flags “gt1_flag” and the flags “gt2_flag”which are used in a sub-block is limited. For example, a total number ofthe flags “gt1_flag” is limited up to n_1, and a total number of theflags “gt2_flag” is limited up to n_2. For example, n_1 is an integerwhich satisfies 1≤n_1<16, and n_2 is an integer which satisfies1≤n_2≤16.

For example, as illustrated in FIG. 70 , entropy encoder 110 repeats theprocesses of Steps S210, S220, S430, and S140 for each of the sub-blockssuch that each of the coefficients in the sub-block is encoded.

More specifically, entropy encoder 110 performs the processes of StepsS210 and S220 in the same manner as in the second example of the firstaspect. In other words, first, entropy encoder 110 encodes, for each ofthe coefficients in the sub-block, the sig_flag of the coefficient, andencodes the parity_flag of the coefficient when the “sig_flag” is 1. Inaddition, entropy encoder 110, when the coefficient is a coefficientwhich is not 0 and is at or before the n_1th position, encodes thegt1_flag of the coefficient based on determination of whether theAbsLevel of the coefficient is greater than or equal to 3 (Step S210).Then, entropy encoder 110, for each of the coefficients in thesub-block, when the coefficient is a coefficient which has the AbsLevelgreater than or equal to 3 and is at or before the n_2th position,encodes a gt2_flag of the coefficient based on determination of whetherthe AbsLevel of the coefficient is greater than or equal to 5 (StepS220).

Next, entropy encoder 110, for each of the coefficients in thesub-block, when the AbsLevel of the coefficient is greater than or equalto a baseLevel, encodes remainder=(AbsLevel−baseLevel)/2 of thecoefficient (Step S430). At this time, according to the third aspect,entropy encoder 110 determines a rice parameter which varies accordingto the baseLevel, and encodes the above-described remainder using theencoding method according to the rice parameter.

Then, entropy encoder 110, for each of the coefficients in thesub-block, encodes a sign (plus or minus) of the coefficient when thecoefficient is not 0 (Step S140).

Entropy encoder 110, subsequent to performing the processes of StepsS210, S220, S430, and S140 on the sub-block, performs the processes ofSteps S210, S220, S430, and S140 in the same manner on the othersub-blocks.

FIG. 71 is a flowchart illustrating one example of the detailedprocessing operation of Step S430 illustrated in FIG. 70 . It should benoted that the flowchart illustrated in FIG. 71 includes Steps S431instead of Step S236 of the flowchart illustrated in FIG. 63 .

First, entropy encoder 110 sets the baseLevel to 5 in the same manner asthe second example of the first aspect (Step S231). Then, entropyencoder 110 repeats the processes of Steps S232 to S235 and S431 foreach of the coefficients in the sub-block.

More specifically, entropy encoder 110 performs the processes of StepsS232 to S235 on current coefficient a in the same manner as in thesecond example of the first aspect.

Then, when it is determined that n_2 number of the flags “gt2_flag” havenot been used for coefficients located prior to current coefficient a inscan order in the sub-block (No in Step S234), entropy encoder 110encodes the remainder for coefficient a (Step S431). In addition,entropy encoder 110 also encodes the remainder for coefficient a afterthe processes of Steps S233 and S235 are performed (S236). Morespecifically, entropy encoder 110 encodes (AbsLevel−baseLevel)/2. Itshould be noted that the remainder is encoded when AbsLevel≥baseLevel issatisfied.

Entropy encoder 110, subsequent to performing the processes of StepsS232 to S235 and S431 on a coefficient included a sub-block, alsoperforms the processes of Steps S232 to S235 and S431 in the same manneron the next coefficient included the sub-block. In this manner, theremainder is encoded as necessary for each of the coefficients includedin the sub-block.

Here, in Step S431, when none of the processes of Steps S233 and S235 isperformed, the baseLevel is 5. In addition, baseLevel is 1 when theprocess of Step S233 is performed, and baseLevel is 3 when the processof Step S235 is performed. According to the third aspect, entropyencoder 110 determines a different rice parameter according to thebaseLevel, and encodes the above-described remainder using the encodingmethod according to the rice parameter. The encoding method according tothe rice parameter is any one of three encoding methods illustrated inFIG. 50 , for example.

Specifically, according to the third aspect, a threshold for determininga rice parameter is changed according to a value of the baseLevel.

Specifically, 12 and 25 are used as thresholds when baseLevel=5, in thesame manner as in the first aspect and the second aspect. Accordingly,when sum_minus1<12, entropy encoder 110 determines the rice parameter tobe g=0. In addition, when 12≤sum_minus1<25, entropy encoder 110determines the rice parameter to be g=1. In addition, when25≤sum_minus1, entropy encoder 110 determines the rice parameter to beg=2. Entropy encoder 110 selects an encoding method corresponding to therice parameter determined in the above-described manner, and performsGolomb-Rice coding on a remainder, i.e., (AbsLevel−baseLevel)/2, usingthe selected encoding method.

In addition, when baseLevel=3, a thres_1 that is a value less than 12and a thres_2 that is a value less than 25 are used as the thresholds.It should be noted that the thres_1 and the thres_2 satisfy therelationship of thres_1<thres_2. Accordingly, when sum_minus1<thres_1,entropy encoder 110 determines the rice parameter to be g=0. Inaddition, when thres_1≤sum_minus1<thres_2, entropy encoder 110determines the rice parameter to be g=1. In addition, whenthres_2≤sum_minus1, entropy encoder 110 determines the rice parameter tobe g=2. Entropy encoder 110 selects an encoding method corresponding tothe rice parameter determined in the above-described manner, andperforms Golomb-Rice coding on a remainder, i.e.,(AbsLevel−baseLevel)/2, using the selected encoding method.

In addition, when baseLevel=1, a thres_3 that is a value less than thethres_1 and a thres_4 that is a value less than the thres_2 are used asthe thresholds. It should be noted that the thres_3 and the thres_4satisfy the relationship of thres_3<thres_4. Accordingly, whensum_minus1<thres_3, entropy encoder 110 determines the rice parameter tobe g=0. In addition, when thres_3≤sum_minus1<thres_4, entropy encoder110 determines the rice parameter to be g=1. In addition, whenthres_4≤sum_minus1, entropy encoder 110 determines the rice parameter tobe g=2. Entropy encoder 110 selects an encoding method corresponding tothe rice parameter determined in the above-described manner, andperforms Golomb-Rice coding on a remainder, i.e.,(AbsLevel−baseLevel)/2, using the selected encoding method.

As a more specific example, the above-described four thresholds arethres_1=2, thres_2=12, thres_3=1, and thres_4=2.

In such an example as described above, when baseLevel=3, the riceparameter is determined as below.

When sum_minus1<2, the rice parameter is determined to be g=0. This isbecause, when g=0, it is possible to make the code length of theremainder shortest. More specifically, when sum_minus1<2, the fivesurrounding coefficients which neighbor the current coefficient asillustrated in FIG. 51 , for example, are each 1 or 2 in average.Accordingly, the current coefficient is predicted to be 3 or 4, and theremainder of the current coefficient is predicted to be 0. In thismanner, as illustrated in FIG. 52 , when the rice parameter is g=0, itis possible to make the code length of the remainder shortest.

When 2≤sum_minus1<12, the rice parameter is determined to be g=1. Thisis because, when g=1, it is possible to make the code length of theremainder shortest. More specifically, when 2≤sum_minus1<12, the fivesurrounding coefficients which neighbor the current coefficient asillustrated in FIG. 51 , for example, are each 3 or 4 in average.Accordingly, the current coefficient is predicted to be 5 or 6, and theremainder of the current coefficient is predicted to be 1. In thismanner, as illustrated in FIG. 52 , when the rice parameter is g=1, itis possible to make the code length of the remainder shortest.

When 12≤sum_minus1, the rice parameter is determined to be g=2. This isbecause, when g=2, it is possible to make the code length of theremainder shortest. More specifically, when 12≤sum_minus1, the fivesurrounding coefficients which neighbor the current coefficient asillustrated in FIG. 51 , for example, are each greater than or equal to5 in average. Accordingly, the current coefficient is predicted to begreater than or equal to 7, and the remainder of the current coefficientis predicted to be greater than or equal to 2. In this manner, asillustrated in FIG. 52 , when the rice parameter is g=2, it is possibleto make the code length of the remainder shortest.

In addition, when baseLevel=1, the rice parameter is determined asbelow.

When sum_minus1=0, the rice parameter is determined to be g=0. This isbecause, when g=0, it is possible to make the code length of theremainder shortest. More specifically, when sum_minus1=0, the fivesurrounding coefficients which neighbor the current coefficient asillustrated in FIG. 51 , for example, are each 0 or 1 in average.Accordingly, the current coefficient is predicted to be 1 or 2, and theremainder of the current coefficient is predicted to be 0. In thismanner, as illustrated in FIG. 52 , when the rice parameter is g=0, itis possible to make the code length of the remainder shortest.

When 1≤sum_minus1<2, the rice parameter is determined to be g=1. This isbecause, when g=1, it is possible to make the code length of theremainder shortest. More specifically, when 1≤sum_minus1<2, the fivesurrounding coefficients which neighbor the current coefficient asillustrated in FIG. 51 , for example, are each 1 or 2 in average.Accordingly, the current coefficient is predicted to be 3 or 4, and theremainder of the current coefficient is predicted to be 1. In thismanner, as illustrated in FIG. 52 , when the rice parameter is g=1, itis possible to make the code length of the remainder shortest.

When 2≤sum_minus1, the rice parameter is determined to be g=2. This isbecause, when g=2, it is possible to make the code length of theremainder shortest. More specifically, when 2≤sum_minus1, the fivesurrounding coefficients which neighbor the current coefficient asillustrated in FIG. 51 , for example, are each greater than or equal to3 in average. Accordingly, the current coefficient is predicted to begreater than or equal to 5, and the remainder of the current coefficientis predicted to be greater than or equal to 2. In this manner, asillustrated in FIG. 52 , when the rice parameter is g=2, it is possibleto make the code length of the remainder shortest.

(Advantageous Effects of Third Aspect)

According to the third aspect, as compared with the second example ofthe first aspect, an appropriate rice parameter is determined, and thusthere is a possibility that the coding amount of the remainder can bereduced. It should be noted that, although the rice parameter isswitched according to the baseLevel in the third aspect, it is notnecessary to limit the condition to the baseLevel, and the riceparameter may be switched whether or not the number of use of a flag(e.g., the gt1_flag or the gt2_flag) which is used in encoding acoefficient has reached the above-described maximum number. It should benoted that, when encoding a remainder, a method of binarizing theremainder may be switched by the baseLevel without using a riceparameter.

It should be noted that, although the threshold for determining a riceparameter is changed according to a value of the baseLevel in the thirdaspect, a rice parameter may be determined based on a difference betweenthe baseLevel and a prediction value for an absolute value of a currentcoefficient without changing a threshold. In other words, in the thirdaspect, there is the case where, by changing a threshold according to abaseLevel, rice parameters which are mutually different rice parametersare determined for the same the numerical value (e.g., the samesum_minus1) that is compared to the threshold. However, mutuallydifferent rice parameters may be determined by changing, according tothe baseLevel, a numerical value (e.g., the above-described difference)that is compared to the threshold, without changing the threshold. It ispossible to yield an advantageous effect equivalent to the advantageouseffect of the third aspect, in this case as well.

(Summary of Embodiment 2)

According to the present embodiment as described above, a flag is usedin encoding a coefficient, and it is possible to appropriately limit atotal number of the flags.

FIG. 72 is a flowchart illustrating processing operations performed byencoder 100 according to the present embodiment. It should be noted thatthe flowchart illustrated in FIG. 72 indicates the processing operationsof the second example of the first aspect or the third aspect asdescribed above.

Encoder 100 according to the present embodiment includes circuitry andmemory connected to the circuitry, and the circuitry, in operation,performs the processes of Steps S10 and S20.

More specifically, the circuitry encodes, for each of a plurality ofcoefficients included in a structural unit of an image which has beentransformed and quantized, an absolute value of the coefficient inpredetermined order (Step S10). Next, the circuitry encodes, for each ofthe plurality of coefficients, a sign which indicates whether thecoefficient is positive or negative (Step S20). Here, in encoding theabsolute value (Step S10), the circuitry encodes a signal indicatingparity that is the least significant bit of the absolute value (Step S11a). Next, the circuitry determines whether to use a flag for encodingthe absolute value other than the least significant bit, based on afirst condition and a second condition (Step S12 a). Then, when it isdetermined that a flag is to be used, the circuitry encodes the flag bycontext-based adaptive binary arithmetic coding (CABAC) that involvesupdating a symbol occurrence probability (Step S13 a). Theabove-described first condition is a condition based on a magnitude ofan absolute value, and the second condition is a condition for limitingthe number of flags used in the structural unit. For example, theabove-described signal indicating parity is a parity_flag.

In this manner, whether or not to use a flag is determined based on notonly the first condition based on the magnitude of an absolute value ofa coefficient, but also the second condition for limiting the number offlags, and thus it is possible to appropriately limit the number offlags.

It should be noted that when a flag is used, it is possible to reduce acoding amount of an absolute value of a coefficient. When a flag is notused, there is a possibility of an increase in a coding amount of anabsolute value of a coefficient, or more specifically, a coding amountof a remainder for indicating an absolute value of a coefficient. Inaddition, there are cases where the CABAC in which an adaptive andvariable symbol occurrence probability is applied in encoding a flag,and bypass processing of the CABAC, in which a fixed symbol occurrenceprobability is used, is applied in encoding the remainder. Here, in theCABAC in which the variable symbol occurrence probability is used, aprocessing load tends to be higher than the bypass processing.Accordingly, with the encoder according to one aspect of the presentdisclosure, the number of flags can be appropriately limited, and thusit is possible to reduce both of a coding amount of an absolute valueand a processing load for encoding the absolute value.

In addition, in encoding an absolute value (Step S10), the circuitry maycount the number of encoded flags every time a flag is encoded, and maydetermine that a flag is not to be used in encoding an absolute valueother than the least significant bit when the second condition is notsatisfied even when first condition is satisfied. Here, the secondcondition is a condition that a total number of counts corresponding tothe number of flags which have been counted is less than a limit. Thelimit is, for example, the above-described maximum number, and aspecific example thereof is the above-described n_1 or n_2.

For example, in the process of Step S211 in FIG. 61 , the number ofencoded flags “gt1_flag” is counted. Then, when the second conditionthat the total number of counts is less than a limit is satisfied, theprocesses of Steps S115 to S116 b are performed. On the other hand, whenthe second condition is not satisfied, the processes of Steps S115 toS116 b are not performed even when the condition of AbsLevel≠0 (i.e.,the first condition) is satisfied. In other words, it is determined thatthe gt1_flag is not to be used in encoding an absolute value.

In addition, in the process of Step S221 in FIG. 62 , the number ofencoded flags “gt2_flag” is counted. Then, when the second conditionthat the total number of counts is less than the limit is satisfied, theprocesses of Steps S122 to S123 b are performed. On the other hand, whenthe second condition is not satisfied, the processes of Steps S122 toS123 b are not performed even when the condition of AbsLevel≥3 (i.e.,the first condition) is satisfied. In other words, it is determined thatthe gt2_flag is not to be used in encoding an absolute value.

In this manner, every time a flag is encoded, the number of encodedflags is counted. Accordingly, it is possible to more appropriatelylimit the number of flags.

In addition, the first condition may be a condition that an absolutevalue is not the first value, or a condition that an absolute value isgreater than or equal to the second value. For example, first value maybe 0, and the second value may be 3.

With this, for a coefficient whose absolute value is not 0, for example,it is possible to appropriately limit the number of the flags (e.g., thegt1_flag) indicating whether the absolute value is greater than or equalto 3. Alternatively, for a coefficient whose absolute value is greaterthan or equal to 3, for example, it is possible to appropriately limitthe number of flags (e.g., the gt2_flag) indicating whether or not theabsolute value is greater than or equal to 5.

In addition, the flag may include mutually different types of flags.

With this, for example, it is possible to appropriately limit the numberof different types of flags such as the above-described gt1_flag andgt2_flag. It should be noted that flags of different types may alsoinclude, for example, the sig_flag, the parity_flag, etc.

In addition, in encoding an absolute value (Step S10), the circuitry mayderive a remainder including a numerical value for representing anabsolute value when a flag cannot be used or when an absolute valuecannot be represented by only at least one flag. Then, the circuitry mayencode the derived remainder by the bypass processing of the CABAC.

In this manner, it is possible to appropriately encode an absolute valueof a coefficient as a flag or as a data group including at least oneflag and a remainder.

FIG. 73 is a flowchart illustrating encoding a remainder performed byencoder 100 according to the present embodiment. It should be noted thatthe flowchart illustrated in FIG. 73 illustrates the processingoperations of the above-described third aspect.

In the above-described deriving of a remainder, the circuitry determinesa base level (i.e., the above-described baseLevel) which indicates anumerical value which varies according to whether the total number ofcounts has reached a limit. The total number of counts corresponds tothe total number of flags encoded for coefficients located prior to acoefficient corresponding to the remainder (Step S11 b). Next, thecircuitry derives a remainder using the base level which has beendetermined (Step S12 b). In addition, the circuitry selects a binarizingmethod corresponding to the remainder, from among a plurality ofbinarizing methods which are different from one another, based on thebase level used in deriving the remainder (Step S13 b). Next, thecircuitry binarizes the remainder according to the binarizing methodwhich has been selected (Step S14 b), and performs arithmetic coding onthe remainder which has been binarized (Step S15 b).

For example, Step S11 b corresponds to the processes of Steps S231,S233, and S235 illustrated in FIG. 71 . Accordingly, the base leveldetermined when the total number of counts has reached the limit is 1 or3, for example, and is less than the base level (e.g., 5) determinedwhen the total number of counts is less than the limit. Furthermore,Steps S12 b to S15 b correspond to the processes of Step S431illustrated in FIG. 71 .

In this manner, it is possible to appropriately derive, using a baselevel, a remainder corresponding to an absolute value of a coefficient.In addition, since a binarizing method used in binarizing a remainder isselected based on the base level, it is possible to appropriately reducethe coding amount of the remainder.

FIG. 74 is a flowchart illustrating processing operations performed bydecoder 200 according to the present embodiment. It should be noted thatthe flowchart illustrated in FIG. 74 indicates the processing operationsof decoding corresponding to the encoding of the second example of thefirst aspect or the third aspect as described above.

Decoder 200 according to the present embodiment includes circuitry andmemory connected to the circuitry, and the circuitry performs, inoperation, the processes of Steps S30 and S40.

More specifically, the circuitry decodes, for each of a plurality ofcoefficients included in a structural unit of an image which has beenencoded, an absolute value of the coefficient in predetermined order(Step S30). Next, the circuitry decodes, for each of the plurality ofcoefficients, a sign which indicates whether the coefficient is positiveor negative (Step S40). Here, in the structural unit, among N (N is aninteger greater than or equal to 2) coefficients each having an absolutevalue which satisfies a predetermined condition related to a magnitude,a flag is used in encoding the absolute value of each of M (M is aninteger less than N) coefficients, and a flag is not used in encodingthe absolute value of each of the remaining (N−M) coefficients. Inaddition, in decoding the absolute value (Step S30), the circuitrydecodes a signal indicating parity that is the least significant bit ofthe absolute value (Step S31 a). Then, when a flag is used in encodingthe absolute value other than the least significant bit, the circuitrydecodes the flag by context-based adaptive binary arithmetic coding(CABAC) that involves updating a symbol occurrence probability (Step S32a). For example, the above-described signal indicating parity is aparity_flag.

With this, even when the number of flags used in encoding a structuralunit of an image is limited, it is possible to appropriately decode theencoded structural unit of the image.

In addition, the predetermined condition may be a condition that anabsolute value of the coefficient is not the first value, or a conditionthat an absolute value of the coefficient is greater than or equal tothe second value. For example, first value may be 0, and the secondvalue may be 3.

With this, for a coefficient whose absolute value is not 0, for example,even when the number of flags (e.g., the gt1_flag) indicating whetherthe absolute value is greater than or equal to 3 is limited, it ispossible to appropriately decode the encoded structural unit of theimage. With this, for a coefficient whose absolute value is greater thanor equal to 3, for example, even when the number of flags (e.g., thegt2_flag) indicating whether the absolute value is greater than or equalto 5 is limited, it is possible to appropriately decode the encodedstructural unit of the image.

In addition, the flag may include mutually different types of flags

With this, for example, even when the number of each of the differenttypes of flags such as the above-described gt1_flag and gt2_flag islimited, it is possible to appropriately decode the encoded structuralunit of the image. It should be noted that flags of different types mayalso include, for example, the sig_flag, the parity_flag, etc.

In addition, in decoding the absolute value (Step S30), when a remainderincluding a numerical value for representing the absolute value isencoded, the circuitry may decode the remainder by the bypass processingof the CABAC.

In this manner, even when an absolute value of a coefficient is encodedas a flag or a data group including at least one flag and a remainder,it is possible to appropriately decode the encoded structural unit ofthe image.

FIG. 75 is a flowchart illustrating decoding a remainder performed bydecoder 200 according to the present embodiment. It should be noted thatthe flowchart illustrated in FIG. 74 illustrates processing operationsof decoding corresponding to encoding of the above-described thirdaspect.

In the above-described decoding of a remainder, first, the circuitrydetermines a base level (i.e., the above-described baseLevel) whichindicates a numerical value which varies according to whether the totalnumber of counts has reached a limit. The total number of countscorresponds to the total number of flags decoded for coefficientslocated prior to a coefficient corresponding to the remainder (Step S31b). Next, the circuitry performs arithmetic decoding on the remainderinto a binary signal (Step S32 b). Next, the circuitry selects adebinarizing method corresponding to the binary signal, from amongmutually different debinarizing methods, based on the base level whichhas been determined (Step S33 b). Then, the circuitry debinarizes thebinary signal according to the debinarizing method which has beenselected (Step S34 b).

For example, Step S31 b corresponds to the processes of Steps S231,S233, and S235 illustrated in FIG. 71 . Accordingly, the base leveldetermined when the total number of counts has reached the limit is, forexample, 1 or 3, and is less than the base level (e.g., 5) determinedwhen the total number of counts is less than the limit.

In this manner, since a debinarizing method to be used in debinarizing abinary signal is selected based on a base level, it is possible toappropriately decode the remainder.

It should be noted that, although a sub-block is used as one example ofa structural unit of an image according to the present embodiment, thestructural unit is not limited to the sub-block, and the structural unitmay be any unit. In addition, a block including 4×4 pixels included in atransform unit is used as a specific example of a sub-block according tothe present embodiment. However, the sub-block is not limited to thespecific example, and the sub-block may be any block.

In addition, according to the present embodiment, when an absolute valueof each of the plurality of coefficients is sequentially encoded, thetotal number of flags which have already been encoded is counted, andwhen the total number of flags counted is less than a limit or maximumnumber, it is determined that a flag is to be used in encoding anabsolute value of the next coefficient. However, the condition is notlimited to the number of flags, and it may be determined that a flag isto be used when the total number of counts including the number of flagsis less than a limit, and that a flag is not to be used when the totalnumber of counts is not less than the limit. The total only needs to bea numerical value which takes a greater value as the number of flagswhich have already been encoded increases, and the total number ofcounts may include the number of other flags.

In addition, although the number of the flags “gt1_flag” and “gt2_flag”is limited according to the present embodiment, the definition of a flagwhose total number is limited may be any definition. For example,although the gt1_flag is used for a coefficient whose absolute value isnot 0 and indicates whether the absolute value is greater than or equalto 3, the gt1_flag may indicate whether the absolute value is greaterthan or equal to a numerical value other than 3. In addition, althoughthe gt2_flag is used for a coefficient having an absolute value greaterthan or equal to 3 and indicates whether the absolute value is greaterthan or equal to 5, the g2_flag may be used for a coefficient having anabsolute value greater than or equal to a numerical value other than 3and indicate whether the absolute value is greater than or equal to anumerical value other than 5.

[Other Examples]

Encoder 100 and decoder 200 according to the above-described examplesmay be used as an image encoder and an image decoder, respectively, oras a video encoder and a video decoder, respectively.

Alternatively, encoder 100 and decoder 200 may be used as an entropyencoder and an entropy decoder, respectively. In other words, encoder100 and decoder 200 may only correspond to entropy encoder 110 andentropy decoder 202. Other constituent elements may be included inanother apparatus.

Furthermore, at least part of the above-described examples may be usedas an encoding method, a decoding method, an entropy encoding method, anentropy decoding method, or other methods.

It should be noted that, each of the constituent elements may beconfigured in the form of an exclusive hardware product, or may berealized by executing a software program suitable for each of theconstituent elements. Each of the constituent elements may be realizedby means of a program executing unit, such as a CPU and a processor,reading and executing the software program recorded on a recordingmedium such as a hard disk or a semiconductor memory.

More specifically, each of encoder 100 and decoder 200 may includeprocessing circuitry and storage which is electrically connected to theprocessing circuitry and accessible from the processing circuitry. Forexample, the processing circuitry corresponds to processor a1 or b1, andthe storage corresponds to memory a2 or b2.

The processing circuitry includes at least one of the exclusive hardwareand the program executing unit, and executes the processing using thestorage. In addition, when the processing circuitry includes the programexecuting unit, the storage stores a software program that is executedby the program executing unit.

Here, the software for implementing encoder 100, decoder 200, or thelike described above includes programs as indicated below.

For example, the program causes a computer to execute the encodingmethod below. The encoding method includes: encoding, for each of aplurality of coefficients, an absolute value of the coefficient inpredetermined order, the plurality of coefficients being included in astructural unit of an image which has been transformed and quantized;and encoding, for each of the plurality of coefficients, a signindicating whether the coefficient is positive or negative. In theencoding of the absolute value, a signal indicating parity that is aleast significant bit of the absolute value is encoded, whether to use aflag in encoding a portion of the absolute value other than the leastsignificant bit is determined based on a first condition and a secondcondition, and the flag is encoded by context-based adaptive binaryarithmetic coding (CABAC) involving updating a symbol occurrenceprobability when it is determined that the flag is to be used, the firstcondition is based on a magnitude of the absolute value, and the secondcondition is for limiting a total number of flags used in the structuralunit.

In addition, for example, the program causes a computer to execute thedecoding method below. The decoding method includes: decoding, for eachof a plurality of coefficients, an absolute value of the coefficient inpredetermined order, the plurality of coefficients being included in astructural unit of an image which has been encoded; and decoding, foreach of the plurality of coefficients, a sign indicating whether thecoefficient is positive or negative. In the structural unit, among Ncoefficients each having an absolute value which satisfies apredetermined condition related to a magnitude, a flag is used inencoding an absolute value of each of M coefficients, and a flag is notused in encoding an absolute value of each of remaining (N−M)coefficients, N being an integer greater than or equal to 2, M being aninteger less than N, in the decoding of the absolute value, a signalindicating parity that is a least significant bit of the absolute valueis decoded, and when the flag is used in encoding a portion of theabsolute value other than the least significant bit, the flag is decodedby context-based adaptive binary arithmetic coding (CABAC) involvingupdating a symbol occurrence probability.

In addition, each of the constituent elements may be circuitry asdescribed above. The circuitries may be configured as a single circuitryas a whole or may be mutually different circuitries. In addition, eachof the structural elements may be implemented as a general purposeprocessor or as a dedicated processor.

In addition, processes executed by a specific constituent element may beperformed by a different constituent element. In addition, the order inwhich processes are performed may be changed, or a plurality ofprocesses may be performed in parallel. In addition, an encoder/decodermay include encoder 100 and decoder 200.

In addition, the ordinal numbers such as first, second, etc., used forexplanation may be arbitrarily replaced. In addition, an ordinal numbermay be newly added to a given one of the constituent elements, or thelike, or the ordinal number of a given one of the constituent elements,or the like may be removed.

Aspects of encoder 100 and decoder 200 have been described above basedon a plurality of examples. However, aspects of encoder 100 and decoder200 are not limited to these examples. The one or more aspects of thepresent disclosure may encompass each of the examples obtainable byadding, to the embodiments, various kinds of modifications that a personskilled in the art would arrive at and embodiments configurable bycombining constituent elements in different examples within the scope ofthe aspects of encoder 100 and decoder 200.

One or more of the aspects disclosed herein may be performed bycombining at least part of the other aspects in the present disclosure.In addition, one or more of the aspects disclosed herein may beperformed by combining, with other aspects, part of the processesindicated in any of the flow charts according to the aspects, part ofthe configuration of any of the devices, part of syntaxes, etc.

[Implementations and Applications]

As described in each of the above embodiments, each functional oroperational block may typically be realized as an MPU (micro processingunit) and memory, for example. Moreover, processes performed by each ofthe functional blocks may be realized as a program execution unit, suchas a processor which reads and executes software (a program) recorded ona recording medium such as ROM. The software may be distributed. Thesoftware may be recorded on a variety of recording media such assemiconductor memory. Note that each functional block can also berealized as hardware (dedicated circuit). Various combinations ofhardware and software may be employed.

The processing described in each of the embodiments may be realized viaintegrated processing using a single apparatus (system), and,alternatively, may be realized via decentralized processing using aplurality of apparatuses. Moreover, the processor that executes theabove-described program may be a single processor or a plurality ofprocessors. In other words, integrated processing may be performed, and,alternatively, decentralized processing may be performed.

Embodiments of the present disclosure are not limited to the aboveexemplary embodiments; various modifications may be made to theexemplary embodiments, the results of which are also included within thescope of the embodiments of the present disclosure.

Next, application examples of the moving picture encoding method (imageencoding method) and the moving picture decoding method (image decodingmethod) described in each of the above embodiments will be described, aswell as various systems that implement the application examples. Such asystem may be characterized as including an image encoder that employsthe image encoding method, an image decoder that employs the imagedecoding method, or an image encoder-decoder that includes both theimage encoder and the image decoder. Other configurations of such asystem may be modified on a case-by-case basis.

[Usage Examples]

FIG. 76 illustrates an overall configuration of content providing systemex100 suitable for implementing a content distribution service. The areain which the communication service is provided is divided into cells ofdesired sizes, and base stations ex106, ex107, ex108, ex109, and ex110,which are fixed wireless stations in the illustrated example, arelocated in respective cells.

In content providing system ex100, devices including computer ex111,gaming device ex112, camera ex113, home appliance ex114, and smartphoneex115 are connected to internet ex101 via internet service providerex102 or communications network ex104 and base stations ex106 throughex110. Content providing system ex100 may combine and connect anycombination of the above devices. In various implementations, thedevices may be directly or indirectly connected together via a telephonenetwork or near field communication, rather than via base stations ex106through ex110. Further, streaming server ex103 may be connected todevices including computer ex111, gaming device ex112, camera ex113,home appliance ex114, and smartphone ex115 via, for example, internetex101. Streaming server ex103 may also be connected to, for example, aterminal in a hotspot in airplane ex117 via satellite ex116.

Note that instead of base stations ex106 through ex110, wireless accesspoints or hotspots may be used. Streaming server ex103 may be connectedto communications network ex104 directly instead of via internet ex101or internet service provider ex102, and may be connected to airplaneex117 directly instead of via satellite ex116.

Camera ex113 is a device capable of capturing still images and video,such as a digital camera. Smartphone ex115 is a smartphone device,cellular phone, or personal handy-phone system (PHS) phone that canoperate under the mobile communications system standards of the 2G, 3G,3.9G, and 4G systems, as well as the next-generation 5G system.

Home appliance ex114 is, for example, a refrigerator or a deviceincluded in a home fuel cell cogeneration system.

In content providing system ex100, a terminal including an image and/orvideo capturing function is capable of, for example, live streaming byconnecting to streaming server ex103 via, for example, base stationex106. When live streaming, a terminal (e.g., computer ex111, gamingdevice ex112, camera ex113, home appliance ex114, smartphone ex115, or aterminal in airplane ex117) may perform the encoding processingdescribed in the above embodiments on still-image or video contentcaptured by a user via the terminal, may multiplex video data obtainedvia the encoding and audio data obtained by encoding audio correspondingto the video, and may transmit the obtained data to streaming serverex103. In other words, the terminal functions as the image encoderaccording to one aspect of the present disclosure.

Streaming server ex103 streams transmitted content data to clients thatrequest the stream. Client examples include computer ex111, gamingdevice ex112, camera ex113, home appliance ex114, smartphone ex115, andterminals inside airplane ex117, which are capable of decoding theabove-described encoded data. Devices that receive the streamed data maydecode and reproduce the received data. In other words, the devices mayeach function as the image decoder, according to one aspect of thepresent disclosure.

[Decentralized Processing]

Streaming server ex103 may be realized as a plurality of servers orcomputers between which tasks such as the processing, recording, andstreaming of data are divided. For example, streaming server ex103 maybe realized as a content delivery network (CDN) that streams content viaa network connecting multiple edge servers located throughout the world.In a CDN, an edge server physically near the client may be dynamicallyassigned to the client. Content is cached and streamed to the edgeserver to reduce load times. In the event of, for example, some type oferror or change in connectivity due, for example, to a spike in traffic,it is possible to stream data stably at high speeds, since it ispossible to avoid affected parts of the network by, for example,dividing the processing between a plurality of edge servers, orswitching the streaming duties to a different edge server and continuingstreaming.

Decentralization is not limited to just the division of processing forstreaming; the encoding of the captured data may be divided between andperformed by the terminals, on the server side, or both. In one example,in typical encoding, the processing is performed in two loops. The firstloop is for detecting how complicated the image is on a frame-by-frameor scene-by-scene basis, or detecting the encoding load. The second loopis for processing that maintains image quality and improves encodingefficiency. For example, it is possible to reduce the processing load ofthe terminals and improve the quality and encoding efficiency of thecontent by having the terminals perform the first loop of the encodingand having the server side that received the content perform the secondloop of the encoding. In such a case, upon receipt of a decodingrequest, it is possible for the encoded data resulting from the firstloop performed by one terminal to be received and reproduced on anotherterminal in approximately real time. This makes it possible to realizesmooth, real-time streaming.

In another example, camera ex113 or the like extracts a feature amount(an amount of features or characteristics) from an image, compressesdata related to the feature amount as metadata, and transmits thecompressed metadata to a server. For example, the server determines thesignificance of an object based on the feature amount and changes thequantization accuracy accordingly to perform compression suitable forthe meaning (or content significance) of the image. Feature amount datais particularly effective in improving the precision and efficiency ofmotion vector prediction during the second compression pass performed bythe server. Moreover, encoding that has a relatively low processingload, such as variable length coding (VLC), may be handled by theterminal, and encoding that has a relatively high processing load, suchas context-adaptive binary arithmetic coding (CABAC), may be handled bythe server.

In yet another example, there are instances in which a plurality ofvideos of approximately the same scene are captured by a plurality ofterminals in, for example, a stadium, shopping mall, or factory. In sucha case, for example, the encoding may be decentralized by dividingprocessing tasks between the plurality of terminals that captured thevideos and, if necessary, other terminals that did not capture thevideos, and the server, on a per-unit basis. The units may be, forexample, groups of pictures (GOP), pictures, or tiles resulting fromdividing a picture. This makes it possible to reduce load times andachieve streaming that is closer to real time.

Since the videos are of approximately the same scene, management and/orinstructions may be carried out by the server so that the videoscaptured by the terminals can be cross-referenced. Moreover, the servermay receive encoded data from the terminals, change the referencerelationship between items of data, or correct or replace picturesthemselves, and then perform the encoding. This makes it possible togenerate a stream with increased quality and efficiency for theindividual items of data.

Furthermore, the server may stream video data after performingtranscoding to convert the encoding format of the video data. Forexample, the server may convert the encoding format from MPEG to VP(e.g., VP9), may convert H.264 to H.265, etc.

In this way, encoding can be performed by a terminal or one or moreservers. Accordingly, although the device that performs the encoding isreferred to as a “server” or “terminal” in the following description,some or all of the processes performed by the server may be performed bythe terminal, and likewise some or all of the processes performed by theterminal may be performed by the server. This also applies to decodingprocesses.

[3D, Multi-Angle]

There has been an increase in usage of images or videos combined fromimages or videos of different scenes concurrently captured, or of thesame scene captured from different angles, by a plurality of terminalssuch as camera ex113 and/or smartphone ex115. Videos captured by theterminals may be combined based on, for example, the separately obtainedrelative positional relationship between the terminals, or regions in avideo having matching feature points.

In addition to the encoding of two-dimensional moving pictures, theserver may encode a still image based on scene analysis of a movingpicture, either automatically or at a point in time specified by theuser, and transmit the encoded still image to a reception terminal.Furthermore, when the server can obtain the relative positionalrelationship between the video capturing terminals, in addition totwo-dimensional moving pictures, the server can generatethree-dimensional geometry of a scene based on video of the same scenecaptured from different angles. The server may separately encodethree-dimensional data generated from, for example, a point cloud and,based on a result of recognizing or tracking a person or object usingthree-dimensional data, may select or reconstruct and generate a videoto be transmitted to a reception terminal, from videos captured by aplurality of terminals.

This allows the user to enjoy a scene by freely selecting videoscorresponding to the video capturing terminals, and allows the user toenjoy the content obtained by extracting a video at a selected viewpointfrom three-dimensional data reconstructed from a plurality of images orvideos. Furthermore, as with video, sound may be recorded fromrelatively different angles, and the server may multiplex audio from aspecific angle or space with the corresponding video, and transmit themultiplexed video and audio.

In recent years, content that is a composite of the real world and avirtual world, such as virtual reality (VR) and augmented reality (AR)content, has also become popular. In the case of VR images, the servermay create images from the viewpoints of both the left and right eyes,and perform encoding that tolerates reference between the two viewpointimages, such as multi-view coding (MVC), and, alternatively, may encodethe images as separate streams without referencing. When the images aredecoded as separate streams, the streams may be synchronized whenreproduced, so as to recreate a virtual three-dimensional space inaccordance with the viewpoint of the user.

In the case of AR images, the server may superimpose virtual objectinformation existing in a virtual space onto camera informationrepresenting a real-world space, based on a three-dimensional positionor movement from the perspective of the user. The decoder may obtain orstore virtual object information and three-dimensional data, generatetwo-dimensional images based on movement from the perspective of theuser, and then generate superimposed data by seamlessly connecting theimages. Alternatively, the decoder may transmit, to the server, motionfrom the perspective of the user in addition to a request for virtualobject information. The server may generate superimposed data based onthree-dimensional data stored in the server in accordance with thereceived motion, and encode and stream the generated superimposed datato the decoder. Note that superimposed data typically includes, inaddition to RGB values, an a value indicating transparency, and theserver sets the a value for sections other than the object generatedfrom three-dimensional data to, for example, 0, and may perform theencoding while those sections are transparent. Alternatively, the servermay set the background to a determined RGB value, such as a chroma key,and generate data in which areas other than the object are set as thebackground. The determined RGB value may be predetermined.

Decoding of similarly streamed data may be performed by the client(e.g., the terminals), on the server side, or divided therebetween. Inone example, one terminal may transmit a reception request to a server,the requested content may be received and decoded by another terminal,and a decoded signal may be transmitted to a device having a display. Itis possible to reproduce high image quality data by decentralizingprocessing and appropriately selecting content regardless of theprocessing ability of the communications terminal itself In yet anotherexample, while a TV, for example, is receiving image data that is largein size, a region of a picture, such as a tile obtained by dividing thepicture, may be decoded and displayed on a personal terminal orterminals of a viewer or viewers of the TV. This makes it possible forthe viewers to share a big-picture view as well as for each viewer tocheck his or her assigned area, or inspect a region in further detail upclose.

In situations in which a plurality of wireless connections are possibleover near, mid, and far distances, indoors or outdoors, it may bepossible to seamlessly receive content using a streaming system standardsuch as MPEG-DASH. The user may switch between data in real time whilefreely selecting a decoder or display apparatus including the user'sterminal, displays arranged indoors or outdoors, etc. Moreover, using,for example, information on the position of the user, decoding can beperformed while switching which terminal handles decoding and whichterminal handles the displaying of content. This makes it possible tomap and display information, while the user is on the move in route to adestination, on the wall of a nearby building in which a device capableof displaying content is embedded, or on part of the ground. Moreover,it is also possible to switch the bit rate of the received data based onthe accessibility to the encoded data on a network, such as when encodeddata is cached on a server quickly accessible from the receptionterminal, or when encoded data is copied to an edge server in a contentdelivery service.

[Scalable Encoding]

The switching of content will be described with reference to a scalablestream, illustrated in FIG. 77 , which is compression coded viaimplementation of the moving picture encoding method described in theabove embodiments. The server may have a configuration in which contentis switched while making use of the temporal and/or spatial scalabilityof a stream, which is achieved by division into and encoding of layers,as illustrated in FIG. 77 . Note that there may be a plurality ofindividual streams that are of the same content but different quality.In other words, by determining which layer to decode based on internalfactors, such as the processing ability on the decoder side, andexternal factors, such as communication bandwidth, the decoder side canfreely switch between low resolution content and high resolution contentwhile decoding. For example, in a case in which the user wants tocontinue watching, for example at home on a device such as a TVconnected to the internet, a video that the user had been previouslywatching on smartphone ex115 while on the move, the device can simplydecode the same stream up to a different layer, which reduces the serverside load.

Furthermore, in addition to the configuration described above, in whichscalability is achieved as a result of the pictures being encoded perlayer, with the enhancement layer being above the base layer, theenhancement layer may include metadata based on, for example,statistical information on the image. The decoder side may generate highimage quality content by performing super-resolution imaging on apicture in the base layer based on the metadata. Super-resolutionimaging may improve the SN ratio while maintaining resolution and/orincreasing resolution. Metadata includes information for identifying alinear or a non-linear filter coefficient, as used in super-resolutionprocessing, or information identifying a parameter value in filterprocessing, machine learning, or a least squares method used insuper-resolution processing.

Alternatively, a configuration may be provided in which a picture isdivided into, for example, tiles in accordance with, for example, themeaning of an object in the image. On the decoder side, only a partialregion is decoded by selecting a tile to decode. Further, by storing anattribute of the object (person, car, ball, etc.) and a position of theobject in the video (coordinates in identical images) as metadata, thedecoder side can identify the position of a desired object based on themetadata and determine which tile or tiles include that object. Forexample, as illustrated in FIG. 78 , metadata may be stored using a datastorage structure different from pixel data, such as an SEI(supplemental enhancement information) message in HEVC. This metadataindicates, for example, the position, size, or color of the main object.

Metadata may be stored in units of a plurality of pictures, such asstream, sequence, or random access units. The decoder side can obtain,for example, the time at which a specific person appears in the video,and by fitting the time information with picture unit information, canidentify a picture in which the object is present, and can determine theposition of the object in the picture.

[Web Page Optimization]

FIG. 79 illustrates an example of a display screen of a web page oncomputer ex111, for example. FIG. 80 illustrates an example of a displayscreen of a web page on smartphone ex115, for example. As illustrated inFIG. 79 and FIG. 80 , a web page may include a plurality of image linksthat are links to image content, and the appearance of the web page maydiffer depending on the device used to view the web page. When aplurality of image links are viewable on the screen, until the userexplicitly selects an image link, or until the image link is in theapproximate center of the screen or the entire image link fits in thescreen, the display apparatus (decoder) may display, as the image links,still images included in the content or I pictures; may display videosuch as an animated gif using a plurality of still images or I pictures;or may receive only the base layer, and decode and display the video.

When an image link is selected by the user, the display apparatusperforms decoding while, for example, giving the highest priority to thebase layer. Note that if there is information in the HTML code of theweb page indicating that the content is scalable, the display apparatusmay decode up to the enhancement layer. Further, in order to guaranteereal-time reproduction, before a selection is made or when the bandwidthis severely limited, the display apparatus can reduce delay between thepoint in time at which the leading picture is decoded and the point intime at which the decoded picture is displayed (that is, the delaybetween the start of the decoding of the content to the displaying ofthe content) by decoding and displaying only forward reference pictures(I picture, P picture, forward reference B picture). Still further, thedisplay apparatus may purposely ignore the reference relationshipbetween pictures, and coarsely decode all B and P pictures as forwardreference pictures, and then perform normal decoding as the number ofpictures received over time increases.

[Autonomous Driving]

When transmitting and receiving still image or video data such as two-or three-dimensional map information for autonomous driving or assisteddriving of an automobile, the reception terminal may receive, inaddition to image data belonging to one or more layers, information on,for example, the weather or road construction as metadata, and associatethe metadata with the image data upon decoding. Note that metadata maybe assigned per layer and, alternatively, may simply be multiplexed withthe image data.

In such a case, since the automobile, drone, airplane, etc., containingthe reception terminal is mobile, the reception terminal may seamlesslyreceive and perform decoding while switching between base stations amongbase stations ex106 through ex110 by transmitting information indicatingthe position of the reception terminal. Moreover, in accordance with theselection made by the user, the situation of the user, and/or thebandwidth of the connection, the reception terminal may dynamicallyselect to what extent the metadata is received, or to what extent themap information, for example, is updated.

In content providing system ex100, the client may receive, decode, andreproduce, in real time, encoded information transmitted by the user.

[Streaming of Individual Content]

In content providing system ex100, in addition to high image quality,long content distributed by a video distribution entity, unicast ormulticast streaming of low image quality, and short content from anindividual are also possible. Such content from individuals is likely tofurther increase in popularity. The server may first perform editingprocessing on the content before the encoding processing, in order torefine the individual content. This may be achieved using the followingconfiguration, for example.

In real time while capturing video or image content, or after thecontent has been captured and accumulated, the server performsrecognition processing based on the raw data or encoded data, such ascapture error processing, scene search processing, meaning analysis,and/or object detection processing. Then, based on the result of therecognition processing, the server—either when prompted orautomatically—edits the content, examples of which include: correctionsuch as focus and/or motion blur correction; removing low-priorityscenes such as scenes that are low in brightness compared to otherpictures, or out of focus; object edge adjustment; and color toneadjustment. The server encodes the edited data based on the result ofthe editing. It is known that excessively long videos tend to receivefewer views. Accordingly, in order to keep the content within a specificlength that scales with the length of the original video, the servermay, in addition to the low-priority scenes described above,automatically clip out scenes with low movement, based on an imageprocessing result. Alternatively, the server may generate and encode avideo digest based on a result of an analysis of the meaning of a scene.

There may be instances in which individual content may include contentthat infringes a copyright, moral right, portrait rights, etc. Suchinstance may lead to an unfavorable situation for the creator, such aswhen content is shared beyond the scope intended by the creator.Accordingly, before encoding, the server may, for example, edit imagesso as to blur faces of people in the periphery of the screen or blur theinside of a house, for example. Further, the server may be configured torecognize the faces of people other than a registered person in imagesto be encoded, and when such faces appear in an image, may apply amosaic filter, for example, to the face of the person. Alternatively, aspre- or post-processing for encoding, the user may specify, forcopyright reasons, a region of an image including a person or a regionof the background to be processed. The server may process the specifiedregion by, for example, replacing the region with a different image, orblurring the region. If the region includes a person, the person may betracked in the moving picture, and the person's head region may bereplaced with another image as the person moves.

Since there is a demand for real-time viewing of content produced byindividuals, which tends to be small in data size, the decoder may firstreceive the base layer as the highest priority, and perform decoding andreproduction, although this may differ depending on bandwidth. When thecontent is reproduced two or more times, such as when the decoderreceives the enhancement layer during decoding and reproduction of thebase layer, and loops the reproduction, the decoder may reproduce a highimage quality video including the enhancement layer. If the stream isencoded using such scalable encoding, the video may be low quality whenin an unselected state or at the start of the video, but it can offer anexperience in which the image quality of the stream progressivelyincreases in an intelligent manner. This is not limited to just scalableencoding; the same experience can be offered by configuring a singlestream from a low quality stream reproduced for the first time and asecond stream encoded using the first stream as a reference.

[Other Implementation and Application Examples]

The encoding and decoding may be performed by LSI (large scaleintegration circuitry) ex500 (see FIG. 76 ), which is typically includedin each terminal. LSI ex500 may be configured of a single chip or aplurality of chips. Software for encoding and decoding moving picturesmay be integrated into some type of a recording medium (such as aCD-ROM, a flexible disk, or a hard disk) that is readable by, forexample, computer ex111, and the encoding and decoding may be performedusing the software. Furthermore, when smartphone ex115 is equipped witha camera, the video data obtained by the camera may be transmitted. Inthis case, the video data may be coded by LSI ex500 included insmartphone ex115.

Note that LSI ex500 may be configured to download and activate anapplication. In such a case, the terminal first determines whether it iscompatible with the scheme used to encode the content, or whether it iscapable of executing a specific service. When the terminal is notcompatible with the encoding scheme of the content, or when the terminalis not capable of executing a specific service, the terminal may firstdownload a codec or application software and then obtain and reproducethe content.

Aside from the example of content providing system ex100 that usesinternet ex101, at least the moving picture encoder (image encoder) orthe moving picture decoder (image decoder) described in the aboveembodiments may be implemented in a digital broadcasting system. Thesame encoding processing and decoding processing may be applied totransmit and receive broadcast radio waves superimposed with multiplexedaudio and video data using, for example, a satellite, even though thisis geared toward multicast, whereas unicast is easier with contentproviding system ex100.

[Hardware Configuration]

FIG. 81 illustrates further details of smartphone ex115 shown in FIG. 76. FIG. 82 illustrates a configuration example of smartphone ex115.Smartphone ex115 includes antenna ex450 for transmitting and receivingradio waves to and from base station ex110, camera ex465 capable ofcapturing video and still images, and display ex458 that displaysdecoded data, such as video captured by camera ex465 and video receivedby antenna ex450. Smartphone ex115 further includes user interface ex466such as a touch panel, audio output unit ex457 such as a speaker foroutputting speech or other audio, audio input unit ex456 such as amicrophone for audio input, memory ex467 capable of storing decoded datasuch as captured video or still images, recorded audio, received videoor still images, and mail, as well as decoded data, and slot ex464 whichis an interface for SIM ex468 for authorizing access to a network andvarious data. Note that external memory may be used instead of memoryex467.

Main controller ex460, which may comprehensively control display ex458and user interface ex466, power supply circuit ex461, user interfaceinput controller ex462, video signal processor ex455, camera interfaceex463, display controller ex459, modulator/demodulator ex452,multiplexer/demultiplexer ex453, audio signal processor ex454, slotex464, and memory ex467 are connected via bus ex470.

When the user turns on the power button of power supply circuit ex461,smartphone ex115 is powered on into an operable state, and eachcomponent is supplied with power from a battery pack.

Smartphone ex115 performs processing for, for example, calling and datatransmission, based on control performed by main controller ex460, whichincludes a CPU, ROM, and RAM. When making calls, an audio signalrecorded by audio input unit ex456 is converted into a digital audiosignal by audio signal processor ex454, to which spread spectrumprocessing is applied by modulator/demodulator ex452 and digital-analogconversion, and frequency conversion processing is applied bytransmitter/receiver ex451, and the resulting signal is transmitted viaantenna ex450. The received data is amplified, frequency converted, andanalog-digital converted, inverse spread spectrum processed bymodulator/demodulator ex452, converted into an analog audio signal byaudio signal processor ex454, and then output from audio output unitex457. In data transmission mode, text, still-image, or video data maybe transmitted under control of main controller ex460 via user interfaceinput controller ex462 based on operation of user interface ex466 of themain body, for example. Similar transmission and reception processing isperformed. In data transmission mode, when sending a video, still image,or video and audio, video signal processor ex455 compression encodes,via the moving picture encoding method described in the aboveembodiments, a video signal stored in memory ex467 or a video signalinput from camera ex465, and transmits the encoded video data tomultiplexer/demultiplexer ex453. Audio signal processor ex454 encodes anaudio signal recorded by audio input unit ex456 while camera ex465 iscapturing a video or still image, and transmits the encoded audio datato multiplexer/demultiplexer ex453. Multiplexer/demultiplexer ex453multiplexes the encoded video data and encoded audio data using adetermined scheme, modulates and converts the data usingmodulator/demodulator (modulator/demodulator circuit) ex452 andtransmitter/receiver ex451, and transmits the result via antenna ex450.The determined scheme may be predetermined.

When video appended in an email or a chat, or a video linked from a webpage, is received, for example, in order to decode the multiplexed datareceived via antenna ex450, multiplexer/demultiplexer ex453demultiplexes the multiplexed data to divide the multiplexed data into abitstream of video data and a bitstream of audio data, supplies theencoded video data to video signal processor ex455 via synchronous busex470, and supplies the encoded audio data to audio signal processorex454 via synchronous bus ex470. Video signal processor ex455 decodesthe video signal using a moving picture decoding method corresponding tothe moving picture encoding method described in the above embodiments,and video or a still image included in the linked moving picture file isdisplayed on display ex458 via display controller ex459. Audio signalprocessor ex454 decodes the audio signal and outputs audio from audiooutput unit ex457. Since real-time streaming is becoming increasinglypopular, there may be instances in which reproduction of the audio maybe socially inappropriate, depending on the user's environment.Accordingly, as an initial value, a configuration in which only videodata is reproduced, i.e., the audio signal is not reproduced, may bepreferable; audio may be synchronized and reproduced only when an input,such as when the user clicks video data, is received.

Although smartphone ex115 was used in the above example, otherimplementations are conceivable: a transceiver terminal including bothan encoder and a decoder; a transmitter terminal including only anencoder; and a receiver terminal including only a decoder. In thedescription of the digital broadcasting system, an example is given inwhich multiplexed data obtained as a result of video data beingmultiplexed with audio data is received or transmitted. The multiplexeddata, however, may be video data multiplexed with data other than audiodata, such as text data related to the video. Further, the video dataitself rather than multiplexed data may be received or transmitted.

Although main controller ex460 including a CPU is described ascontrolling the encoding or decoding processes, various terminals ofteninclude GPUs. Accordingly, a configuration is acceptable in which alarge area is processed at once by making use of the performance abilityof the GPU via memory shared by the CPU and GPU, or memory including anaddress that is managed so as to allow common usage by the CPU and GPU.This makes it possible to shorten encoding time, maintain the real-timenature of the stream, and reduce delay. In particular, processingrelating to motion estimation, deblocking filtering, sample adaptiveoffset (SAO), and transformation/quantization can be effectively carriedout by the GPU instead of the CPU in units of pictures, for example, allat once.

INDUSTRIAL APPLICABILITY

The present disclosure is applicable to, for example, televisionreceivers, digital video recorders, car navigation systems, mobilephones, digital cameras, digital video cameras, teleconference systems,electronic mirrors, etc.

The various embodiments described above can be combined to providefurther embodiments. All of the U.S. patents, U.S. patent applicationpublications, U.S. patent applications, foreign patents, foreign patentapplications and non-patent publications referred to in thisspecification and/or listed in the Application Data Sheet areincorporated herein by reference, in their entirety. Aspects of theembodiments can be modified, if necessary to employ concepts of thevarious patents, applications and publications to provide yet furtherembodiments.

These and other changes can be made to the embodiments in light of theabove-detailed description. In general, in the following claims, theterms used should not be construed to limit the claims to the specificembodiments disclosed in the specification and the claims, but should beconstrued to include all possible embodiments along with the full scopeof equivalents to which such claims are entitled. Accordingly, theclaims are not limited by the disclosure.

The invention claimed is:
 1. An encoder comprising: memory; and aprocessor coupled to the memory and which, in operation, performsContext-Based Adaptive Binary Arithmetic Coding (CABAC), wherein inprediction residual coding of a current block, the processor, inoperation, encodes a plurality of flags by CABAC, each of the pluralityof flags relating to a coefficient included in the current block;determines a base level in a case where a number of encodable flags hasnot reached a limit; calculates a prediction absolute value of thecoefficient based on a sum of absolute values of five neighboringcoefficients of the coefficient in the current block, wherein theprediction absolute value of the coefficient corresponds to an averageof the absolute values of the five neighboring coefficients; derives arice parameter based on a difference between the prediction absolutevalue and the base level, wherein if the difference is below a firstvalue, the rice parameter is set to zero, if the difference is equal toor larger than the first value and smaller than a second value, the riceparameter is set to one, and if the difference is equal to or largerthan the second value, the rice parameter is set to two; encodes aremainder value of the coefficient using the derived rice parameter,wherein the remainder value is obtained by using an absolute value ofthe coefficient and the base level; and encodes a sign flag indicatingwhether the coefficient has a positive value or a negative value if theabsolute value of the coefficient is more than zero.
 2. The encoderaccording to claim 1, wherein the plurality of flags includes: a firstflag indicating whether the coefficient is zero or not; a second flagindicating whether the coefficient is an odd number or an even number; athird flag indicating whether an absolute value of the coefficient isequal to or larger than a first threshold value; and a fourth flagindicating whether the absolute value of the coefficient is equal to orlarger than a second threshold value that is larger than the firstthreshold value.
 3. The encoder according to claim 1, wherein the fiveneighboring coefficients include: a first neighboring coefficientlocated next to a right side of the coefficient; a second neighboringcoefficient located next to a right side of the first neighboringcoefficient; a third neighboring coefficient located below thecoefficient; a fourth neighboring coefficient located below the thirdneighboring coefficient; and a fifth neighboring coefficient locatednext to a right side of the third neighboring coefficient.
 4. Theencoder according to claim 1, wherein the encoding of the plurality offlags and the encoding of the remainder value are repeated for each of aplurality of coefficients included in the current block until the numberof encodable flags reach the limit.
 5. An encoding method, comprising:in prediction residual coding of a current block, encoding a pluralityof flags by Context-Based Adaptive Binary Arithmetic Coding (CABAC),each of the plurality of flags relating to a coefficient included in thecurrent block; determining a base level in a case where a number ofencodable flags has not reached a limit; calculating a predictionabsolute value of the coefficient based on a sum of absolute values offive neighboring coefficients in the current block, wherein theprediction absolute value of the coefficient corresponds to an averageof the absolute values of the five neighboring coefficients; deriving arice parameter based on a difference between the prediction absolutevalue and the base level, wherein if the difference is below a firstvalue, the rice parameter is set to zero, if the difference is equal toor larger than the first value and smaller than a second value, the riceparameter is set to one, and if the difference is equal to or largerthan the second value, the rice parameter is set to two; encoding aremainder value of the coefficient using the derived rice parameter,wherein the remainder value is obtained by using an absolute value ofthe coefficient and the base level; and encoding a sign flag indicatingwhether the coefficient has a positive value or a negative value if theabsolute value of the coefficient is more than zero.
 6. The encodingmethod according to claim 5, wherein the plurality of flags include: afirst flag indicating whether the coefficient is zero or not; a secondflag indicating whether the coefficient is an odd number or an evennumber; a third flag indicating whether an absolute value of thecoefficient is equal to or larger than a first threshold value; and afourth flag indicating whether the absolute value of the coefficient isequal to or larger than a second threshold value that is larger than thefirst threshold value.
 7. The encoding method according to claim 5,wherein the five neighboring coefficients include: a first neighboringcoefficient located next to a right side of the coefficient; a secondneighboring coefficient located next to a right side of the firstneighboring coefficient; a third neighboring coefficient located belowthe coefficient; a fourth neighboring coefficient located below thethird neighboring coefficient; and a fifth neighboring coefficientlocated next to a right side of the third neighboring coefficient. 8.The encoding method according to claim 5, wherein the encoding of theplurality of flags and the encoding of the remainder value are repeatedfor each of a plurality of coefficients included in the current blockuntil the number of encodable flags reach the limit.
 9. A decodercomprising: memory; and a processor coupled to the memory and which, inoperation, performs Context-Based Adaptive Binary Arithmetic Coding(CABAC) decoding, wherein in prediction residual decoding of a currentblock, the processor, in operation, decodes a plurality of flags byCABAC decoding, each of the plurality of flags relating to a coefficientincluded in the current block; determines a base level in a case where anumber of decodable flags has not reached a limit; calculates aprediction absolute value of the coefficient based on a sum of absolutevalues of five neighboring coefficients of the coefficient in thecurrent block, wherein the prediction absolute value of the coefficientcorresponds to an average of the absolute values of the five neighboringcoefficients; derives a rice parameter based on a difference between theprediction absolute value and the base level, wherein if the differenceis below a first value, the rice parameter is set to zero, if thedifference is equal to or larger than the first value and smaller than asecond value, the rice parameter is set to one, and if the difference isequal to or larger than the second value, the rice parameter is set totwo; decodes a remainder value of the coefficient using the derived riceparameter, wherein the remainder value is obtained by using an absolutevalue of the coefficient and the base level; and decodes a sign flagindicating whether the coefficient has a positive value or a negativevalue if the absolute value of the coefficient is more than zero.
 10. Adecoding method, comprising: in prediction residual decoding of acurrent block, decoding a plurality of flags by Context-Based AdaptiveBinary Arithmetic Coding (CABAC) decoding, each of the plurality offlags relating to a coefficient included in the current block;determining a base level in a case where a number of decodable flags hasnot reached a limit; calculating a prediction absolute value of thecoefficient based on a sum of absolute values of five neighboringcoefficients in the current block, wherein the prediction absolute valueof the coefficient corresponds to an average of the absolute values ofthe five neighboring coefficients; deriving a rice parameter based on adifference between the prediction absolute value and the base level,wherein if the difference is below a first value, the rice parameter isset to zero, if the difference is equal to or larger than the firstvalue and smaller than a second value, the rice parameter is set to one,and if the difference is equal to or larger than the second value, therice parameter is set to two; decoding a remainder value of thecoefficient using the derived rice parameter, wherein the remaindervalue and the base level are used to obtain an absolute value of thecoefficient; and decoding a sign flag indicating whether the coefficienthas a positive value or a negative value if the absolute value of thecoefficient is more than zero.
 11. A non-transitory computer readablemedium storing a bitstream for a decoder to perform prediction residualdecoding of a current block, the bitstream comprising: a plurality offlags that are encoded by Context-Based Adaptive Binary ArithmeticCoding (CABAC), each of the plurality of flags relating to a coefficientincluded in the current block; and a remainder value of the coefficientthat is encoded by using a rice parameter, wherein the remainder valueand a base level are used to obtain an absolute value of thecoefficient, the base level being a parameter determined in a case wherea number of decodable flags has not reached a limit, wherein the riceparameter is derived based on a difference between a prediction absolutevalue and the base level, wherein the prediction absolute value of thecoefficient is calculated based on a sum of absolute values of fiveneighboring coefficients in the current block, wherein the predictionabsolute value of the coefficient corresponds to an average of theabsolute values of the five neighboring coefficients, and wherein if thedifference is below a first value, the rice parameter is set to zero, ifthe difference is equal to or larger than the first value and smallerthan a second value, the rice parameter is set to one, and if thedifference is equal to or larger than the second value, the riceparameter is set to two; and a sign flag indicating whether thecoefficient has a positive value or a negative value if the absolutevalue of the coefficient is more than zero.